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
Q&A
These days, DTDs and XML schemas are both popular. Which should I use?
The answer depends on several factors. Which does your target XML processor support? Which are you more comfortable with? Can DTDs give you the precision you want, or do you need to turn to schemas? DTDs have been around longer than schemas. A casual Web search turns up 1.9 million matches to "DTD" but only 385,000 to "XML schema." And many beginning XML authors find DTDs easier to work with than schemas. Nonetheless, XML schemas are where the growth is these days. Microsoft has thrown its weight behind schemas, so the industry as a whole is shifting toward them.
The DTD syntax is just too complex. Isn't there some way to make writing a DTD easier?
Take a look at the automatic DTD generators available online. You just navigate to a DTD generator on the Web, click a button to browse to the XML document on your disk for which you want a DTD, and click a button to upload the document; the DTD generator does the rest. For example, take a look at the DTD generators at (as of this writing) http://www.pault.com/pault/dtdgenerator and http://www.hitsw.com/xml_utilites.
Workshop | Next Section

Account Sign In
View your cart