Sams Teach Yourself XML in 21 Days
- Table of Contents
- About the Author
- Acknowledgments
- We Want to Hear from You!
- Introduction
- Part I: At a Glance
- Day 1. Welcome to XML
- Day 2. Creating XML Documents
- Day 3. Creating Well-Formed XML Documents
- Day 4. Creating Valid XML Documents: DTDs
- Declaring Attributes in DTDs
- Day 6. Creating Valid XML Documents: XML Schemas
- Day 7. Creating Types in XML Schemas
- Part I. In Review
- Day 8. Formatting XML by Using Cascading Style Sheets
- Day 9. Formatting XML by Using XSLT
- Day 10. Working with XSL Formatting Objects
- Part II. In Review
- Part III: At a Glance
- Day 11. Extending HTML with XHTML
- Day 12. Putting XHTML to Work
- Day 13. Creating Graphics and Multimedia: SVG and SMIL
- Day 14. Handling XLinks, XPointers, and XForms
- Part III. In Review
- Part IV: At a Glance
- Day 15. Using JavaScript and XML
- Day 16. Using Java and .NET: DOM
- Day 17. Using Java and .NET: SAX
- Day 18. Working with SOAP and RDF
- Part IV. In Review
- Part V: At a Glance
- Day 19. Handling XML Data Binding
- Day 20. Working with XML and Databases
- Day 21. Handling XML in .NET
- Part V. In Review
- Appendix A. Quiz Answers
Using XML Browsers
Calling a browser an XML browser means one of two things. As we've seen, a browser like Internet Explorer can display XML documents, and you can even use CSS or XSL to format those documents for display. However, displaying an XML document's data is one thing—making use of that data is another, and you do that in the second type of XML browser.
For example, with JavaScript you can access the data in an XML document in a browser like Internet Explorer, and you can also rewrite the HTML the browser will display. There are also dedicated XML browsers for some XML applications, and they can go far beyond HTML. We'll see one such example of a dedicated XML browser today—Jumbo, which displays XML documents using Chemical Markup Language (CML) to represent chemical molecules (and we'll build our own visual XML browser later in this book). We'll take a look at a few XML browsers now.
Using XML in Internet Explorer
Whether you love it or hate it, Microsoft's Internet Explorer is by far the most powerful general-purpose XML browser available today. You can get it at http://www.microsoft.com/windows/ie/default.asp.
The current version of Internet Explorer, version 6, is strongly XML-enabled, so we're going to see it frequently in this book. This doesn't imply a bias for or against Microsoft; it just means that there's no way to ignore this browser in a book on XML that aims to be as complete as possible. Internet Explorer can display XML documents directly, as we've already seen. It can use scripting languages like JavaScript (technically JScript, Microsoft's version of JavaScript) to access the data in an XML document and let you handle that data in code (including rewriting the HTML the browser displays, creating your own XML browser that displays your numeric data using bar graphs, and so on). It can also handle XML with both CSS and XSL style sheets, allowing you to format and display XML data as you like. It can validate XML documents using both DTDs and XML schemas (it's the only widely available browser that can use schemas). It can bind XML data to HTML controls like text boxes and buttons. There's even a special element, <XML>, that can load in XML documents automatically. We're going to see all this and more in this book.
Internet Explorer is not the only program that Microsoft has enabled for XML—XML is also used throughout the Microsoft Office suite of applications, and it's fundamental to the .NET initiative, as we're going to see towards the end of this book.
Using XML in Netscape Navigator
There's also some support for XML in the Netscape Navigator browser, which you can get at http://channels.netscape.com/ns/browsers/default.jsp. The current version is 7.0, and although this browser doesn't display raw XML documents in the same way that Internet Explorer does, you can use CSS style sheets to display XML documents in the Netscape Navigator, just as you can in Internet Explorer.
Using CML in Jumbo
Jumbo is a dedicated XML browser designed to display CML documents. You can get Jumbo free at http://www.xml-cml.org/. Jumbo can display XML (but not with style sheets), as well as using CML to draw molecules. There's an online version of Jumbo at http://www.xml-cml.org/jumbo3/jumbo3-JS/jumbo.html, and you can see it at work in Figure 2.5, drawing a picture of the ethanol molecule from CML.
Figure 2.5 Using the XML browser Jumbo to display the ethanol molecule.
Besides XML browsers like these, other tools called validators let you check your XML after you've written it.
Using XML Validators | Next Section

Account Sign In
View your cart