Extending XHTML with a Driver DTD

So far, I've extended XHTML by adding elements and attributes to a DTD. You can also create a driver DTD to do the same thing (in fact, the W3C is working on creating schemas for XHTML as well as DTDs). A driver DTD does not contain any DTD declarations except for parameter entities. The parameter entities are what you use to include other DTD sections, creating one combined DTD.

For example, I can create a new DTD, ch17_22.dtd, with this new XHTML element:

Listing ch17_22.dtd
 <!ELEMENT underlinedredtext (#PCDATA)> <!ATTLIST underlinedredtext underlinedredtextattribute CDATA #IMPLIED > 

Now I can put together a new driver DTD that includes both ch17_22.dtd and the XHTML 1.0 transitional DTD, like this:

Listing ch17_23.dtd
 <!ENTITY % XHTMLExtensionDTD      SYSTEM "http://www.starpowder.com/DTDs/ch17_22.dtd"> %XHTMLExtensionDTD; <!ENTITY % XHTML1.0TransitionalDTD PUBLIC "-//W3C//DTD XHTML 1.0 Transitiona l//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> %XHTML1.0TransitionalDTD; 

That's all it takes. Now when you want to exclude a section of the combined DTD, you have to just comment out its parameter entity reference. One thing to note: When you're creating a DTD from multiple parts like this, make sure there are no declaration conflicts. If there arefor example, if there's a conflict between some elements in MathML and XHTMLmake sure you use namespaces.



Real World XML
Real World XML (2nd Edition)
ISBN: 0735712867
EAN: 2147483647
Year: 2005
Pages: 440
Authors: Steve Holzner

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