Home > Articles

  • Print
  • + Share This
This chapter is from the book


  1. I don’t plan on creating any of my own custom markup languages. Do I still need to know the details of DTDs and XSDs?
  2. Yes. In many cases, markup languages aren’t documented too well, which means the DTD or XSD for a language may be all you have to go by when it comes to figuring out the format of documents.
  3. Would I ever want to create both a DTD and an XSD for a custom markup language?
  4. Probably not. The only reason you might do this is if you create a DTD initially for convenience, and later replace it with an XSD as your needs change and as you migrate to tools that demand support for XML Schema (XSDs).
  5. Why would you ever want to use an internal DTD?
  6. Because an internal DTD is declared directly in an XML document and not in an external file, it applies only to that particular document. Therefore, you should only use an internal DTD for markup declarations that apply to a specific document. Otherwise, all markup declarations should be placed in an external DTD so that they can be reused with other documents.
  7. Why would you use an attribute over an element when designing a DTD?
  8. Attributes provide tighter constraints on data, can be constrained against a predefined list of possible values, and can have default values. Element content is much less constrained, and is better suited for housing long strings of text and other child elements. A golden rule of XML design is that the more constraints you can impose on a document, the more structured its content will be. Knowing this, you should attempt to fit data into attributes whenever possible.
  • + Share This
  • 🔖 Save To Your Account