If you have two tags with the same name in an XML document, do you have to use two different schema's for each tag or can you use 1 schema, would it validate? below is an example where it is using 2 schema's, but I am using only 1 schema, which one is correct?
XML Document Using 2 Schema's
<?xml version="1.0" encoding="ISO-8859-1"?>
<receipt xmlns: cu="http://www.mydomain.com/customer"
xmlns: pr="http://www.mydomain.com/product"> <!--two schema's being referenced-->
<cu:customer> <!--Using Schema 1-->
<cu:name> Michael Johnson </cu:name>
<cu:areaCode> BH2 3XY </cu:areaCode>
</cu:customer>
<products>
<pr:product> <!--Using Schema 2-->
<pr:name>RAM</pr:name>
<pr:quantity>100</pr:quantity>
</pr:product>
</products>
</receipt>
My XML Document Using 1 Schema (has 2 tags with the same name, called item)
<?xml version=" 1.0" encoding="UTF-8"?>
<shiporder orderid="889923" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="shiporder.xsd">
<orderperson>John Smith</orderperson>
<shipto>
<name>Ola Nordmann</name>
<address>Langgt 23</address>
<city>4000 Stavanger</city>
<country>Norway</country>
</shipto>
<item>
<title>Empire Burlesque</title>
<note>Special Edition</note>
<quantity>1</quantity>
<price>10.90</price>
</item>
<item>
<title>Hide your heart</title>
<quantity>1</quantity>
<price>9.90</price>
</item>
</shiporder>
XML Schema:
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="shiporder">
<xs:complexType >
<xs:sequence>
<xs:element type="xs:string" name="orderperson"/>
<xs:element name="shipto">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="name"/>
<xs:element type="xs:string" name="address"/>
<xs:element type="xs:string" name="city"/>
<xs:element type="xs:string" name="country"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="item" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="note" type="xs:string" minOccurs="0"/> <!--optional-->
<xs:element name="quantity" type="xs:integer"/>
<xs:element name="price" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="orderid" type="xs:int" /> <!--must be required-->
</xs:complexType>
</xs:element>