S
Sascha Kerschhofer
If I define more than one element "globally" in an XML schema, is there any
hint which one is the actual root element for any instance document?
e.g.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="a">
<xs:complexType>
<xs:sequence>
<xs:element ref="b"/>
<xs:element name="c"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="b"/>
</xs:schema>
allows two valid instance documents. First is
<?xml version="1.0" encoding="UTF-8"?>
<a>
<b>Text</b>
<c>Text</c>
</a>
Second is simply
<?xml version="1.0" encoding="UTF-8"?>
<b/>
Of course a is meant as root element but I want to use global elements for
reuse however. How can I avoid this ambiguousity?
Thank you.
Sascha
hint which one is the actual root element for any instance document?
e.g.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="a">
<xs:complexType>
<xs:sequence>
<xs:element ref="b"/>
<xs:element name="c"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="b"/>
</xs:schema>
allows two valid instance documents. First is
<?xml version="1.0" encoding="UTF-8"?>
<a>
<b>Text</b>
<c>Text</c>
</a>
Second is simply
<?xml version="1.0" encoding="UTF-8"?>
<b/>
Of course a is meant as root element but I want to use global elements for
reuse however. How can I avoid this ambiguousity?
Thank you.
Sascha