R
Ray Lischner
I have a schema that contains a choice of groups, and one of the groups
contains an empty sequence. I can validate an XML document and the
schema with some validators, but not Xerces. It says "Empty content not
valid for content model: '((one,two)|((a,b),c))', which indicates that
it is ignoring the "empty" group. I think Xerces is wrong, but I'm not
100% certain. What do you think?
The schema is:
<?xml version="1.0" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:group name="empty">
<xsd:sequence/>
</xsd:group>
<xsd:group name="numbers">
<xsd:sequence>
<xsd:element name="one" type="xsd:int"/>
<xsd:element name="two" type="xsd:int"/>
</xsd:sequence>
</xsd:group>
<xsd:group name="letters">
<xsd:sequence>
<xsd:element name="a" type="xsd:string"/>
<xsd:element name="b" type="xsd:string"/>
<xsd:element name="c" type="xsd:string"/>
</xsd:sequence>
</xsd:group>
<xsd:complexType name="list">
<xsd:sequence>
<xsd:element name="item" minOccurs="1" maxOccurs="3">
<xsd:complexType mixed="true">
<xsd:choice>
<xsd:group ref="empty"/>
<xsd:group ref="numbers"/>
<xsd:group ref="letters"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="root" type="list"/>
</xsd:schema>
Here's a sample XML document:
<?xml version="1.0" encoding="utf-8" ?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="test.xsd">
<item>Nothing</item>
<item>Numbers
<one>1</one>
<two>2</two>
</item>
<item>Letters
<a>A</a>
<b>B</b>
<c>C</c>
</item>
</root>
Who's right, Xerces or me? Thanks.
contains an empty sequence. I can validate an XML document and the
schema with some validators, but not Xerces. It says "Empty content not
valid for content model: '((one,two)|((a,b),c))', which indicates that
it is ignoring the "empty" group. I think Xerces is wrong, but I'm not
100% certain. What do you think?
The schema is:
<?xml version="1.0" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:group name="empty">
<xsd:sequence/>
</xsd:group>
<xsd:group name="numbers">
<xsd:sequence>
<xsd:element name="one" type="xsd:int"/>
<xsd:element name="two" type="xsd:int"/>
</xsd:sequence>
</xsd:group>
<xsd:group name="letters">
<xsd:sequence>
<xsd:element name="a" type="xsd:string"/>
<xsd:element name="b" type="xsd:string"/>
<xsd:element name="c" type="xsd:string"/>
</xsd:sequence>
</xsd:group>
<xsd:complexType name="list">
<xsd:sequence>
<xsd:element name="item" minOccurs="1" maxOccurs="3">
<xsd:complexType mixed="true">
<xsd:choice>
<xsd:group ref="empty"/>
<xsd:group ref="numbers"/>
<xsd:group ref="letters"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="root" type="list"/>
</xsd:schema>
Here's a sample XML document:
<?xml version="1.0" encoding="utf-8" ?>
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="test.xsd">
<item>Nothing</item>
<item>Numbers
<one>1</one>
<two>2</two>
</item>
<item>Letters
<a>A</a>
<b>B</b>
<c>C</c>
</item>
</root>
Who's right, Xerces or me? Thanks.