Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

schema question

Status
Not open for further replies.

lfc77

Programmer
Joined
Aug 12, 2003
Messages
218
Location
GB
I have an element in my schema <service> which has an attribute called "type". So you can have <service type="request">, <service type="change"> etc. Request and Change both have different sets of tags in them. I have written a schema for where type=change (see below), but I'm not sure how to add Request to it. Can anybody help me out?

<xs:element name="service">
<xs:complexType>
<xs:sequence>
<xs:element name="info" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="number" type="xs:long" minOccurs="1" />
<xs:element name="subcug" type="xs:long" minOccurs="0" />
<xs:element name="pay" type="xs:string" minOccurs="0" />
<xs:element name="currency" type="xs:string" minOccurs="0" />
<xs:element name="language" type="xs:string" minOccurs="0" />
<xs:element name="cash" type="xs:float" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="type" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="change" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>


Thanks,

lfc77
 
Just add another enumeration value for your type attribute.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Chip,

But how and where do I add the structure of what is acceptable within the tag?

This is allowed in the <service type="request"> :

<service type="request">
<type>ukgeo</type>
<area>441280</area>
<pay>card</pay>
</service>

And this for the <service type="change"> :

<service type="change">
<info>
<number>441173060201</number>
<subcug>1234</subcug>
<pay>card</pay>
<currency>gbp</currency>
<language>eng</language>
<cash>20.00</cash>
</info>
</service>

There can only be 1 service type per XML document.


Thanks,

lfc77
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top