A.6. W3C XML SchemaAs we have seen, the W3C XML Schema is a strongly typed schema language that eliminates any nondeterministic design from the described markup to insure that there is no ambiguity in the determination of the datatypes, and that the validation can be performed by a finite state machine. Table A-2 provides the fact sheet for W3C XML Schema. Table A-2. W3C XML Schema fact sheet
A.6.1. Example<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="library"> <xs:complexType> <xs:sequence> <xs:element name="book" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="isbn" type="xs:string"/> <xs:element name="title" type="xs:string"/> <xs:element name="author-ref" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:attribute name="id" type="xs:IDREF" use="required"/> </xs:complexType> </xs:element> <xs:element name="character-ref" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:attribute name="id" type="xs:IDREF" use="required"/> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="id" type="xs:ID" use="required"/> </xs:complexType> </xs:element> <xs:element name="author" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element ref="name"/> <xs:element name="nickName" type="xs:string"/> <xs:element name="born" type="xs:string"/> <xs:element name="dead" type="xs:string"/> </xs:sequence> <xs:attribute name="id" type="xs:ID" use="required"/> </xs:complexType> </xs:element> <xs:element name="character" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element ref="name"/> <xs:element name="since" type="xs:string"/> <xs:element name="qualification" type="xs:string"/> </xs:sequence> <xs:attribute name="id" type="xs:ID" use="required"/> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="name" type="xs:string"/> </xs:schema> Copyright © 2002 O'Reilly & Associates. All rights reserved. |
|