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
Workshop
This workshop tests whether you understand the concepts discussed today. It's a good idea to make sure you can answer these questions before pressing on to tomorrow's work. Answers to the quiz can be found in Appendix A, "Quiz Answers."
Quiz
- What keyword do you use in an <!ATTLIST> element to make an attribute optional?
- What keyword do you use in an <!ATTLIST> element to make sure an attribute always has the same value?
- How can you declare a required name attribute, an optional address attribute, and an optional phone attribute for an element named <friend>? Each of these attributes should hold simple character data.
- How can you restrict an attribute named married in an element named <relative> to values of "yes" or "no", making the default "no"?
- How can you declare an external unparsed entity named mountains that corresponds to the image file mountains.jpg?
Exercises
- Create a new XML document that uses a DTD to declare an optional CDATA attribute named date that holds dates in the form 4/1/05, an attribute called sex that can take the values "male" and "female" only, and a required CDATA name attribute. Test your work by using an online XML validator.
- Parameterize the DTD you created in Exercise 1 so that you can include all the attributes created in that exercise by setting a parameter named includer to INCLUDE or exclude them by setting that parameter to IGNORE.
Day 6. Creating Valid XML Documents: XML Schemas | Next Section

Account Sign In
View your cart