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
Part I. In Review
In Part I, which is all about creating XML documents, you got the basics, including how to write XML documents, how to create well-formed documents, and how to make sure XML documents are valid. You saw that there can be various parts in an XML document, not all of which must appear in all documents:
- XML declarations
- Processing instructions
- Elements and attributes
- Comments
- CDATA sections
- Entities
For example, this XML document, which holds the names of clients for whom you might be doing some programming, begins with an XML declaration, and the document element is <document>:
<?xml version = "1.0" standalone="yes"?>
<document>
<client>
<name>
<lastname>Kirk</lastname>
<firstname>James</firstname>
</name>
<contractDate>September 5, 2092</contractDate>
<contracts>
<contract>
<app>Comm</app>
<id>111</id>
<fee>$111.00</fee>
</contract>
<contract>
<app>Accounting</app>
<id>222</id>
<fee>$989.00</fee>
</contract>
</contracts>
</client>
<client>
<name>
<lastname>McCoy</lastname>
<firstname>Leonard</firstname>
</name>
<contractDate>September 7, 2092</contractDate>
<contracts>
<contract>
<app>Stocker</app>
<id>333</id>
<fee>$2995.00</fee>
</contract>
<contract>
<app>Dialer</app>
<id>444</id>
<fee>$200.00</fee>
</contract>
</contracts>
</client>
<client>
<name>
<lastname>Spock</lastname>
<firstname>Mr.</firstname>
</name>
<contractDate>September 9, 2092</contractDate>
<contracts>
<contract>
<app>WinHook</app>
<id>555</id>
<fee>$129.00</fee>
</contract>
<contract>
<app>MouseApp</app>
<id>666</id>
<fee>$25.00</fee>
</contract>
</contracts>
</client>
</document>
Each element here has an opening and closing tag, and each element is nested properly.
Well-Formed Documents | Next Section

Account Sign In
View your cart