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
Day 5. Handling Attributes and Entities in DTDs
Yesterday you got your start with DTDs by seeing how to declare and handle elements. But that's only part of the story. Today's discussion continues with DTDs, explaining how to handle the other items you can declare in DTDs—attributes and entities. Both attributes and entities are essential parts of XML, and today's discussion will explain how to support them in valid XML documents. Here's an overview of the topics covered in today's discussion:
- Declaring attributes
- Understanding legal attribute types
- Using default values for attributes
- Making attributes required
- Giving attributes fixed values
- Working with entities
- Using general and parameter entities
- Working with internal and external entities
- Handling binary data
The term entity might seem worrisome, but it's actually very simple: In an XML document, an entity is simply a data item. In other words, entity is simply XML's way of referring to a piece of data. And you already know about the other big topic for today—attributes, which we'll start discussing now.
Day 5. Handling Attributes and Entities in DTDs | Next Section

Account Sign In
View your cart