Steve Lawrence created XERCESC-2243:
---------------------------------------
Summary: choice validation with branch an empty sequence does not
validate correctly
Key: XERCESC-2243
URL: https://issues.apache.org/jira/browse/XERCESC-2243
Project: Xerces-C++
Issue Type: Bug
Components: Validating Parser (XML Schema)
Reporter: Steve Lawrence
Say we have this schema, which contains a choice where one branch is an empty
sequence:
{code:xml}
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="root">
<xs:complexType>
<xs:choice>
<xs:element name="foo" type="xs:int" />
<xs:sequence />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
{code}
This XML with a foo child validates correctly:
{code:xml}
<root>
<foo>3</foo>
</root>
{code}
But, this fails to validate:
{code:xml}
<root></root>
{code}
With error message:
{quote}
Message: empty content is not valid for content model '(foo)'
{quote}
Related, if you change the XML to this, it also fails to validate:
{code:xml}
<root/>
{code}
But with a slightly different error message:
{quote}
Message: element 'root' is not allowed for content model '(foo)'
{quote}
The expected behavior is that all above XML snippets should validate.
Note that in our specific case, the empty sequence has annotations on it that
make the branch meaningful even though it seems empty from an XML schema
perspective. Adding something like minOccurs="0" to the choice or the foo
element is not possible.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]