QA


Q&A

Q.

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?

A.

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.

Q.

Would I ever want to create both a DTD and an XSD for a custom markup language?

A.

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).

Q.

Why would you ever want to use an internal DTD?

A.

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.

Q.

Why would you use an attribute over an element when designing a DTD?

A.

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.




Sams Teach Yourself XML in 24 Hours
Sams Teach Yourself XML in 24 Hours, Complete Starter Kit (3rd Edition)
ISBN: 067232797X
EAN: 2147483647
Year: 2005
Pages: 266

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net