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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSD: Element data dependant on attribute value...

Status
Not open for further replies.

maztheozzie

Programmer
Feb 11, 2002
4
0
0
AU
Hi guys,

Noob question...

I have a XML structure as follows;

<PRODUCT DEFINITION>
<PRODUCT OPTION ID=1990>128</PRODUCT OPTION>
<PRODUCT OPTION ID=1290>CC</PRODUCT OPTION>
<PRODUCT OPTION ID=1430>1</PRODUCT OPTION>
...
</PRODUCT DEFINITION>

I want to define a XSD definition to limit what values can be entered for the <PRODUCT OPTION> element based on what the attribute ID has been set to. For example, ID=1430 allows only 1,2,3 whereas ID=1431 alows a,b,c.

Is this possible??? I have read through a stack of documentation without much luck so any help is much appreciated!

Thanks in advance.

Cheers,

Maz
 
Thanks Tom.

I am confused. What part of my question is not XML the element definition or what I want to do?

Maz
 
Maz,

Your example is not correct XML.[ul][li]Element names cannot contain spaces.[/li][li]Attribute values must be contained in quotation marks.[/li][/ul]

This is covered in the XML tutorial mentioned in my last post.

Finally, your question was recently asked (with only a minor variation) and answered in this thread: thread426-1338322.

Tom Morrison
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top