Friday, August 29, 2003

A Compact Syntax for W3C XML Schema

The article A Compact Syntax for W3C XML Schema on XML.com by Erik Wilde presents an interesting alternative to the verbose W3C XML Schema while preserving the same semantic.
Here's an example from the article to give you an idea:

W3C Schema fragment:
<xs:element name="complexContent" id="complexContent">

<xs:complexType>
<xs:complexContent>
<xs:extension base="xs:annotated">
<xs:choice>
<xs:element name="restriction" type="xs:complexRestrictionType"/>

<xs:element name="extension" type="xs:extensionType"/>
</xs:choice>
<xs:attribute name="mixed" type="xs:boolean"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>


XSCS (XML Schema Compact Syntax):
element complexContent extends xs:annotated {

( restriction { xs:complexRestrictionType } | extension { xs:extensionType } )
attribute \mixed { xs:boolean } }


That's definitely less verbose although I don't know if I like the curly bracket and the backslash that much ;-)

No comments: