XML schema Doubt!
Could any one tell me开发者_StackOverflow社区 how to do this? i need to change it into **xml schema**. The problem that I am facing is that I can't think of where to use elements and wehere to use attributes.
IF i consider these as attributes:<xs:attribute name="name" type="xs:string" use="required"/>**
- i will use this statement. But then where do I make use of occurances. It can only be done with elements?Right?
Since you want Name
and Phone
to appear in order, you must use elements, since the order of attributes in XML documents is (per the XML recommendation) not significant.
Your schema should look (in outline) something like:
<xs:element name="RetailerRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="Name"
minOccurs="1"
maxOccurs="1"/>
<xs:element ref="RetailerContact"
minOccurs="1"
maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="RetailerContact">
<xs:complexType>
<xs:sequence>
<xs:element name="Name"
minOccurs="1"
maxOccurs="1"/>
<xs:element name="Phone"
minOccurs="1"
maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
精彩评论