W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2003

(really the) same element with different attributes

From: <cbornste@akamai.com>
Date: Wed, 30 Apr 2003 14:31:21 -0400 (EDT)
Message-ID: <16048.5753.871832.217402@rio.kendall.corp.akamai.com>
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>



 Hi all,

 I've been playing with xml schemas for the last week, and I've
learned a lot, but I still can't figure this one out. I've seen
simmilar questions in this list, but I haven't found one that was
really what I wanted to know. 

 here's what I would like to do:

 I would like to use a schema to check an xml file that looks like
this:

 <address country="US" state="MA" county="whoknows" >
    <zip code="01234"/>
 <address>

or

 <address country="Brazil" city="Rio"/>

What I mean with this really bad example is:

 The two adreesses above should be interchangeable in the xml
file. However, they should have different sets of atrributes that are
valid, depending on the value of the attribute country. In fact, even
the zip code, would only be allowed if the value of country was US.

 I know I could change the xml to say something like 

<USAddress ...>
 <zip ...?
</USAddress>

and 

<address .../>

But I kind of already have the xml I want to use -- so I was hoping to
have a schema capable of checking these conditions. Is this possible
??

 Thanks

Claudson
Received on Wednesday, 30 April 2003 14:41:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:36 GMT