[ http://issues.apache.org/jira/browse/XERCESJ-1202?page=all ]

Michael Glavassevich reassigned XERCESJ-1202:
---------------------------------------------

    Assignee: Michael Glavassevich

> DTD validation on XIncluded documents when the schema language is set to XML 
> Schema
> -----------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1202
>                 URL: http://issues.apache.org/jira/browse/XERCESJ-1202
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XInclude 1.0
>    Affects Versions: 2.8.1
>            Reporter: George Cristian Bina
>         Assigned To: Michael Glavassevich
>
> 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 {
>           schemaLanguage = 
>             
> "http://www.w3.org/2001/XMLSchema".equals(componentManager.getProperty(
>                 "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
>             ));
>         } catch (XMLConfigurationException e) {}
>         if (schemaLanguage) {
>           fSettings.setFeature(DYNAMIC_VALIDATION, false);
>           fSettings.setFeature(VALIDATION, false);
>         }
> Thanks,
> George

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to