Mega Code Archive

 
Categories / XML Tutorial / XML Schema
 

A book element of our library

File:Data.xml <book xmlns="http://www.rntsoft.com"      identifier="isbn-0836217462">   <isbn>0836217462</isbn>   <title>Java</title>   <author-ref ref="anotherRef" />   <chapter-refs>     ref   </chapter-refs> </book> File: Schema.xsd <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"   targetNamespace="http://www.rntsoft.com" xmlns="http://www.rntsoft.com"   elementFormDefault="qualified">   <xs:element name="book">     <xs:complexType>       <xs:sequence>         <xs:element name="isbn" type="xs:string" />         <xs:element name="title" type="xs:string" />         <xs:element name="author-ref">           <xs:complexType>             <xs:attribute name="ref" type="xs:string"               use="required" />           </xs:complexType>         </xs:element>         <xs:element name="chapter-refs" type="xs:string" />       </xs:sequence>       <xs:attribute name="identifier" type="xs:ID" use="required" />     </xs:complexType>   </xs:element> </xs:schema>