Entities and namespaces in XSchemata
Peter Murray-Rust
peter at ursus.demon.co.uk
Sat May 30 00:14:49 BST 1998
This is probably blindingly obvious to everyone already (especially SGML
experts) but I had a sudden revelation today. Essentially everything that
parameter entities do in ordinary DTDs maps onto general or text entities
in XSchemata. Thus by crafting your XSchemata in XML you get - for free -
the maintainability produced by entities:
<!DOCTYPE XSchema SYSTEM "xschema.dtd" [
<!ENTITY bar.default "plugh">
]>
<ElementType id="foo">
<Attribute id="bar">
<Type>CDATA</Type>
<Default>&bar.default;</Default>
</Attribute>
</ElementType>
I am not an XML/SGML theorist, but it seems to me that anything that PEs
can do for DTDs can be mirrored by entities in XSchemata. This extends to
content specs, and - this could be exciting - namespaces. Watch:
<!DOCTYPE XSchema SYSTEM "xschema.dtd" [
<!ENTITY cml "CML:">
]>
<ElementType id="&cml:mol">
<ContentSpec>
<Seq optional="no" repeatable="no">
<ElementType>&cml;atoms</ElementType>
</Seq>
<Seq optional="yes" repeatable="no">
<ElementType>&cml;bonds</ElementType>
</Seq>
</ContentSpec>
</ElementType>
To me this looks as if we can create our DTDs to be namespace-aware and -
if necessary - reconfigure them. Thus if I have to change the prefix CML
because of a clash with the Caledonian Music Lovers, I simply have to edit
one ENTITY in the XSchema. [If there is an sgmls-like 'include' facility in
the software, then I can even do it at runtime.] Since we have committed to
reconstituting 'normalised DTDs' from XSchemata, doesn't this take us
forward in maintaining namespace-aware DTDs? (We can't do it in
conventional ones, because PEs don't apply to elementTypes).
P.
Peter Murray-Rust, Director Virtual School of Molecular Sciences, domestic
net connection
VSMS http://www.nottingham.ac.uk/vsms, Virtual Hyperglossary
http://www.venus.co.uk/vhg
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list