XML Schema that describes a self-describing XML document
Posted
by Raegx
on Stack Overflow
See other posts from Stack Overflow
or by Raegx
Published on 2010-05-02T07:23:49Z
Indexed on
2010/05/02
7:27 UTC
Read the original article
Hit count: 420
xml-schema
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.
© Stack Overflow or respective owner