Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Discover RELAX NG, A Simple Schema Solution : Page 3

With the goals of compact syntax and compatibility, the Regular Language Description for XML (RELAX NG) eases the pain of working with cumbersome DTDs and XSDs.


advertisement

Complex Types

Compared with XSD, RELAX NG does not support simpleType and complexType tags. However, you can build complex types by grouping the named patterns define and ref. For example, complexType studentRoll can be built using references to studentID and studentSSN:

<start> <oneOrMore> <element name="studentRoll"> <ref name="studentID "/> <ref ssn="studentSSN "/> </element> </oneOrMore> </start>

Sequence Tag
By default, XSD defines the complex type elements in ordered sequence. XML tools on the market such as XMLSpy, 4Suite, and Stylus use the sequence tag to mandate that the elements within a complex type be ordered in sequence. As a result, though you define all the sub-elements, they must be in the order specified in the schema. This limits the full features of inheritance, because it restricts the definition of a subset of elements and what can be inherited from it. RELAX NG relaxes this restriction by providing the interleave tag:


<start> <element name="parentNames"> <interleave> <element name="motherName"><text/></element> <optional> <element name="fatherName"><text/></element> </optional> </interleave> </element> </start>

The above schema specifies that the parentNames can be interleaved, so mother's name or the optional father's name need not follow the order specified in the schema.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap