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

XSD: same element with different properties

Status
Not open for further replies.

lantoli

ISP
Feb 23, 2006
1
GB
I have this XML:

...
<data>
...
<field name="color">red</field>
<field name="doors">4</field>
...
</data>
...

I wonder if it's possible to make a schema that constrains the field elements, so the first field name must be color, next one doors, etc. It'd also be very useful if the data type could be constrained, e.g. color is a string, doors is a decimal.

The problem I'm facing is that all elements have the same name, "field", so I don't know how to constrain them in a sequence.

Thanks a lot for your help.
 
You can't do this because the element name is the same -- there's no way for an XSD restriction to work because it can't tell the difference between the two types of content.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top