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!

newbie needs schema help

Status
Not open for further replies.

lfc77

Programmer
Joined
Aug 12, 2003
Messages
218
Location
GB
I have an element which can only appear once in my XML document and has 1 attribute. The attribute determines what elements are accepted within this element. For example, my XML document can have this element :

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

or this one, but not more than 1 service element.

<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>

I'm new to writing schemas and I'm not sure how to do this, or whether this is a simple or complex problem.

If anybody can help me out it would be really appreciated.


Cheers,

lfc

 
In you schema .xsd file :

<xsd:element name="service" minOccurs="0" maxOccurs="1">
 
But how do I make it so that if type="request" it only accepts <type>, <area> and <pay>, and if type="change" it only accepts <info>?

lfc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top