FYI to the DFDL schema development community--we recently discovered that Xerces-C has a bug where it does not correctly validate choices with an empty sequence as a branch.

For example, say we have this schema:

   <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>

This pattern is not uncommon in DFDL schemas, usually used with an initiator or hidden group ref placed on the empty xs:sequence.

When using Xerces-C, this XML validates as expected:

   <root>
     <foo>1</foo>
   </root>

But XML without the foo element fails to validate even though it is valid XML, such as:

   <root />

or

   <root></root>

A bug has been opened with Xerces-C [1], but the project is fairly inactive so it's not clear when/if it will be fixed. So when developing DFDL schemas where users might want to use Xerces-C to validate the resulting infoset, you may want to consider alternatives. For example, maybe an element can be used instead, or a hidden group ref can be replace with a normal group ref.

[1] https://issues.apache.org/jira/browse/XERCESC-2243

Reply via email to