(really the) same element with different attributes

 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 UTC