Document Content Description
XML-Data and RDF were submitted to the W3C for consideration within months of each other. Immediately, whether rightly or wrongly, the players involved (Microsoft: XML-Data and Netscape: RDF) were accused of proposing proprietary solutions that would lock people into their solution.
The Document Content Description (DCD) proposal attempts to find the best compromise between the two proposals, taking a subset of the XML-Data proposal and expressing it in a way that is consistent with RDF (in technical terms, DCD is an RDF vocabulary).
Put most simply, the heart of DCD is an ElementDef element that has either the Type, Model, Occurs, RDF:Order, Content, Root, Fixed, and Datatype attributes, or that contains these elements. The ElementDef element, in fact, describes an element contained in an XML document. As well as these "special" elements (or attributes), the ElementDef element also contains details of the elements that it may contain and the definitions of their attributes. A typical DCD declaration in an XML DTD could look like the following:
<ElementDefType="shape"Model="Elements">
<AttributeDefName="n"Occurs="Optional"/>
<AttributeDefName="Sides"/>
</ElementDef>
<ElementDefType="squareshape"Model="Element">
<AttributeDefName="Sides"Occurs="Optional">
<Default>3</Default>
</AttributeDef>
<Element>side</Element>
<ExtendsType="shape"/>
</ElementDef>
And in the associated XML document, a typical element could look something like this:
<squareshape n="4"> <side><dimension unit='in'>5<dimension></side> </squareshape>
Just as in RDF, child elements can be grouped and, if required, you can declare whether the order of the child elements is important or not, as shown in Listing 17.4.
Listing 17.4 Typical DCD Element Definitions
1: <ElementDefType="Candidate"Model="Elements"> 2: <Description>Personal Details</Description> 3: <GroupRDF:Order="Seq"> 4: <Element>GivenName</Element> 5: <GroupOccurs="Optional"> 6: <Element>Initial</Element> 7: </Group> 8: <Element>FamilyName</Element> 9: <Element>common:Address</Element> 10: <ElementDefType="Telephone"Datatype="string"/> 11: </Group> 12: </ElementDef> 13: 14: <ElementDefType="Loan"> 15: <Description>MorgageLoan</Description> 16: <GroupRDF:Order="Seq"> 17: <Element>InterestRate</Element> 18: <Element>Amount</Element> 19: <Element>Maturity</Element> 20: </Group> 21: </ElementDef>
Because DCD is a product of both XML-Data and RDF, all the strong points of both are present, such as XML-Data's data typing and RDF's flexibility.