XML Schema - how do you conditionally require address elements? (street, city, state, etc)

Posted by Sly on Stack Overflow See other posts from Stack Overflow or by Sly
Published on 2010-06-05T21:59:55Z Indexed on 2010/06/05 22:02 UTC
Read the original article Hit count: 214

Filed under:
|
|

If an address can be composed of child elements: Street, City, State, PostalCode...how do you allow this XML:

 <Address>
         <Street>Somestreet</Street> 
         <PostalCode>zip</PostalCode>                     
 </Address>

and allow this:

<Address>
     <Street>Somestreet</Street> 
     <City>San Jose</City>
     <State>CA</State>
</Address>

but not this:

<Address>
    <Street>Somestreet</Street> 
    <City>San Jose</City>
</Address>

What schema will do such things!?

© Stack Overflow or respective owner

Related posts about Xml

Related posts about xsd