- From: waste <waste20030@yahoo.com>
- Date: Thu, 12 Apr 2007 03:24:41 -0700 (PDT)
- To: xmlschema-dev@w3.org
Hello, I'm following the example in the XML schema tutorial from the w3.org, however I can't understand the design method based on defining all elements and attributes first, and then referring to them using the ref attribute: <?xml version="1.0" encoding="ISO-8859-1" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <!-- definition of simple elements --> <xs:element name="orderperson" type="xs:string"/> <xs:element name="name" type="xs:string"/> <xs:element name="address" type="xs:string"/> <xs:element name="city" type="xs:string"/> <xs:element name="country" type="xs:string"/> <xs:element name="title" type="xs:string"/> <xs:element name="note" type="xs:string"/> <xs:element name="quantity" type="xs:positiveInteger"/> <xs:element name="price" type="xs:decimal"/> <!-- definition of attributes --> <xs:attribute name="orderid" type="xs:string"/> <!-- definition of complex elements --> <xs:element name="shipto"> <xs:complexType> <xs:sequence> <xs:element ref="name"/> <xs:element ref="address"/> <xs:element ref="city"/> <xs:element ref="country"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="item"> <xs:complexType> <xs:sequence> <xs:element ref="title"/> <xs:element ref="note" minOccurs="0"/> <xs:element ref="quantity"/> <xs:element ref="price"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="shiporder"> <xs:complexType> <xs:sequence> <xs:element ref="orderperson"/> <xs:element ref="shipto"/> <xs:element ref="item" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute ref="orderid" use="required"/> </xs:complexType> </xs:element> </xs:schema> The question is how can I identify the desired root element of the target document? I can see from the example it's the "shiporder" element, but why not the "orderto" or "shipto" or "item" elements that are previously defined ? Thank you ! --------------------------------- The fish are biting. Get more visitors on your site using Yahoo! Search Marketing. --0-1512336615-1176373481=:25933 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hello,<br><br>I'm following the example in the XML schema tutorial from the w3.org, however I can't understand the design method based on defining all elements and attributes first, and then referring to them using the ref attribute:<br><br><pre><?xml version="1.0" encoding="ISO-8859-1" ?><br><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"></pre> <pre><!-- definition of simple elements --><br><xs:element name="orderperson" type="xs:string"/><br><xs:element name="name" type="xs:string"/><br><xs:element name="address" type="xs:string"/><br><xs:element name="city" type="xs:string"/><br><xs:element name="country" type="xs:string"/><br><xs:element name="title" type="xs:string"/><br><xs:element name="note" type="xs:string"/><br><xs:element name="quantity" type="xs:positiveInteger"/><br><xs:element name="price" type="xs:decimal"/></pre> <pre><!-- definition of attributes --><br><xs:attribute name="orderid" type="xs:string"/></pre> <pre><!-- definition of complex elements --><br><xs:element name="shipto"><br> <xs:complexType><br> <xs:sequence><br> <xs:element ref="name"/><br> <xs:element ref="address"/><br> <xs:element ref="city"/><br> <xs:element ref="country"/><br> </xs:sequence><br> </xs:complexType><br></xs:element><br><xs:element name="item"><br> <xs:complexType><br> <xs:sequence><br> <xs:element ref="title"/><br> <xs:element ref="note" minOccurs="0"/><br> <xs:element ref="quantity"/><br> <xs:element ref="price"/><br> </xs:sequence><br> </xs:complexType><br></xs:element></pre> <pre><xs:element name="shiporder"><br> <xs:complexType><br> <xs:sequence><br> <xs:element ref="orderperson"/><br> <xs:element ref="shipto"/><br> <xs:element ref="item" maxOccurs="unbounded"/><br> </xs:sequence><br> <xs:attribute ref="orderid" use="required"/><br> </xs:complexType><br></xs:element></pre> <pre></xs:schema></pre><br>The question is how can I identify the desired root element of the target document? I can see from the example it's the "shiporder" element, but why not the "orderto" or "shipto" or "item" elements that are previously defined ?<br><br>Thank you !<br><p>  <hr size=1>The fish are biting.<br> <a href="http://us.rd.yahoo.com/evt=49679/*http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php?o=US2140&cmp=Yahoo&ctv=Q107Tagline&s=Y&s2=EM&b=50"> Get more visitors</a> on your site using <a href=" http://us.rd.yahoo.com/evt=49679/*http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php?o=US2140&cmp=Yahoo&ctv=Q107Tagline&s=Y&s2=EM&b=50">Yahoo! Search Marketing.</a> --0-1512336615-1176373481=:25933--
Received on Friday, 13 April 2007 02:01:38 UTC