XML Schema that describes a self-describing XML document
- by Raegx
Is it possible to write an XML Schema that describes an XML document that lists a set of elements and then requires other elements on that same XML document to use those values as either attributes and/or sub-elements?
Example: define a list of locations, then force location attributes and/or location elements to be of those values.
<root>
<locations>
<location>Home</location>
<location>Office</location>
<location>School</location>
</locations>
<addresses>
<address location="Home">...</address>
<address location="Office">...</address>
</addresses>
</root>
or
<root>
<locations>
<location>Home</location>
<location>Office</location>
<location>School</location>
</locations>
<addresses>
<address>
<location>Home</location>
...
</address>
<address>
<location>Office</location>
...
</address>
</addresses>
</root>
I am failing hard at finding the proper way to search for this information. I suspect it is either not possible or I just don't know the right search terms.