Mega Code Archive

 
Categories / XML / XML Schema
 

Reference your type with namespace

File: Data.xml <?xml version="1.0"?> <Books xmlns="http://www.rntsoft.com"            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"            xsi:schemaLocation="http://www.rntsoft.com Schema.xsd">         <Book>                 <Title>title 1</Title>                 <Author>author 1</Author>                 <Date>2008</Date>                 <ISBN>1-11111-111-1</ISBN>                 <Publisher>Publisher 1</Publisher>         </Book>         <Book>                 <Title>title 2</Title>                 <Author>author 2</Author>                 <Date>2007</Date>                 <ISBN>0-111-11111-1</ISBN>                 <Publisher>Publisher 2</Publisher>         </Book>         <Book>                 <Title>title 3</Title>                 <Author>author 3</Author>                 <Date>2004</Date>                 <ISBN>0-11-111111-1</ISBN>                 <Publisher>Publisher 3</Publisher>         </Book>         </Books> File: Schema.xml <?xml version="1.0"?> <schema xmlns="http://www.w3.org/2001/XMLSchema"         targetNamespace="http://www.rntsoft.com"         xmlns:bk="http://www.rntsoft.com"         elementFormDefault="qualified">     <element name="Books">         <complexType>             <sequence>                 <element ref="bk:Book" minOccurs="1" maxOccurs="unbounded"/>             </sequence>         </complexType>     </element>     <element name="Book">         <complexType>             <sequence>                 <element ref="bk:Title"/>                 <element ref="bk:Author"/>                 <element ref="bk:Date"/>                 <element ref="bk:ISBN"/>                 <element ref="bk:Publisher"/>             </sequence>         </complexType>     </element>     <element name="Title" type="string"/>     <element name="Author" type="string"/>     <element name="Date" type="string"/>     <element name="ISBN" type="string"/>     <element name="Publisher" type="string"/> </schema>