140 likes | 160 Views
Explore Parameterized and Modularized DTDs, Namespaces, XML Schemas, Entities, Macros, and more. Learn how to organize DTDs effectively using entities for better document structuring. Discover the power of parameter entities in real-world applications.
E N D
XML Validation IIAdvanced DTDs Robin Burke ECT 360
Outline • Parameter entities • Parameterized DTDs • Modularized DTDs • Break • Namespaces • XML Schemas • Elements • Attributes
Entities • Internal general entities • macros • External general entities • "include" mechanism • Parameter entities • for DTD organization
Internal general entities • Declaration <!ENTITY disclaimer "This is a work of fiction. Any resemblance to persons living or dead is unintentional."> • Use &disclaimer;
External general entities • Declaration <!ENTITY standardContract SYSTEM "stdContract.xml"> • Use <comment>... transaction subject to the following contract terms: &standardContract;</comment>
General entities • Process model • The entity string is replaced by the contents • And then parsed by the XML parser • Resulting document tree • same as if the text were part of the original document
Parameter entities • Similar macro function • Inside the DTD • Uses • Organizing common element / attribute models • Documenting data types • Simulating namespaces • Making DTDs modular
Conditional sections • To control the inclusion of DTD sections • This will be processed • <![INCLUDE[ ... ]]> • This will be omitted • <!IGNORE[ .. ]]> • Doesn't seem that useful BUT • combined with entities • we can modularize our DTD
Modular DTD • Same DTD can be used for multiple document types • A few parameters are redefined and the DTD is different
Parameter entities • Powerful facility for DTD organization and application • Real-world applications • parameterize DTDs • use modular DTDs
Example • DTDs • Document • Problem • how to import the namespaces?
Solution • Fully-qualified names everywhere • yuk! • Parameterized DTD • with namespace defined in an entity
Next week • Document Engineering • on-line reading • Quiz #1 • DTDs