Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.8.1
-
None
Description
When a validation is performed with the schema language property set to XML Schema the DTDs should not be used for validation. This happens when validating a document but not on the included documents. Below you can find an example to reproduce the problem and a proposed patch.
foos.xml
<?xml version="1.0" encoding="UTF-8"?>
<foos xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="foo.xsd"
xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="foo.xml"/>
</foos>
foo.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [ ]>
<foo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="foo.xsd"/>
foo.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="foo"/>
<xs:element name="foos">
<xs:complexType>
<xs:sequence>
<xs:element ref="foo" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Proposed pacth
At the end of the reset method in XIncludeHandler we should check if the schema language property is set to XML Schema and disable the validation and dynamic validation features for the XIncluded documents as we perform the validation only on the main document with the XInclude resolved. One possible implementation of the above is to add the following lines at the end of XIncludeHandler.reset()
boolean schemaLanguage = false;
try
catch (XMLConfigurationException e) {}
if (schemaLanguage)
Thanks,
George