You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Vojtech Habarta (JIRA)" <xe...@xml.apache.org> on 2005/10/02 12:43:47 UTC

[jira] Created: (XERCESJ-1101) Validating DocumentBuilder instance fails to parse more than one XML document.

Validating DocumentBuilder instance fails to parse more than one XML document.
------------------------------------------------------------------------------

         Key: XERCESJ-1101
         URL: http://issues.apache.org/jira/browse/XERCESJ-1101
     Project: Xerces2-J
        Type: Bug
  Components: JAXP (javax.xml.parsers)  
    Versions: 2.7.0, 2.7.1    
    Reporter: Vojtech Habarta
    Priority: Critical



When DocumentBuilder instance with W3C XML Schema validation is created using JAXP 1.2 and is used for parsing it fails on second XML document.

Here is sample code snippet:

    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true);
    factory.setValidating(true);
    Object[] schemaSource = new Object[] {
        // it is important to pass schemas as InputStreams to prevent schemas reparsing
        ParsingTest.class.getResourceAsStream("ParsingTest.xsd"),
    };
    factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
    factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaSource);
    DocumentBuilder documentBuilder = factory.newDocumentBuilder();
    documentBuilder.setErrorHandler(...);
    documentBuilder.parse(new FileInputStream("C:\\ParsingTest.xml"));
    System.out.println("OK");
    documentBuilder.parse(new FileInputStream("C:\\ParsingTest.xml"));
    System.out.println("OK");

When this code is run it throws this exception:

Exception in thread "main" org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'A'.
        at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
        at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
        at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:76)
        at test.ParsingTest.main(ParsingTest.java:34)

This code fail on Xerces 2.7.0 and 2.7.1. It works on Xerces 2.2.1, 2.3.0, 2.4.0, 2.5.0, 2.6.0, 2.6.1 and 2.6.2. It also works on jaxp 1.2.2, jaxp 1.3.1 and JDK 1.5.

This issue is very important for us because new validation API doesn't meet our performance requirements and requires JAXP 1.3 compatible parser (is less portable).


-- 
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: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


[jira] Assigned: (XERCESJ-1101) Validating DocumentBuilder instance fails to parse more than one XML document.

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XERCESJ-1101?page=all ]

Michael Glavassevich reassigned XERCESJ-1101:
---------------------------------------------

    Assign To: Michael Glavassevich

> Validating DocumentBuilder instance fails to parse more than one XML document.
> ------------------------------------------------------------------------------
>
>          Key: XERCESJ-1101
>          URL: http://issues.apache.org/jira/browse/XERCESJ-1101
>      Project: Xerces2-J
>         Type: Bug
>   Components: JAXP (javax.xml.parsers)
>     Versions: 2.7.0, 2.7.1
>     Reporter: Vojtech Habarta
>     Assignee: Michael Glavassevich
>     Priority: Critical
>  Attachments: ParsingTest.java, ParsingTest.xml, ParsingTest.xsd
>
> When DocumentBuilder instance with W3C XML Schema validation is created using JAXP 1.2 and is used for parsing it fails on second XML document.
> Here is sample code snippet:
>     DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
>     factory.setNamespaceAware(true);
>     factory.setValidating(true);
>     Object[] schemaSource = new Object[] {
>         // it is important to pass schemas as InputStreams to prevent schemas reparsing
>         ParsingTest.class.getResourceAsStream("ParsingTest.xsd"),
>     };
>     factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
>     factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaSource);
>     DocumentBuilder documentBuilder = factory.newDocumentBuilder();
>     documentBuilder.setErrorHandler(...);
>     documentBuilder.parse(new FileInputStream("C:\\ParsingTest.xml"));
>     System.out.println("OK");
>     documentBuilder.parse(new FileInputStream("C:\\ParsingTest.xml"));
>     System.out.println("OK");
> When this code is run it throws this exception:
> Exception in thread "main" org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'A'.
>         at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
>         at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>         at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
>         at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
>         at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
>         at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
>         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
>         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>         at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
>         at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
>         at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:76)
>         at test.ParsingTest.main(ParsingTest.java:34)
> This code fail on Xerces 2.7.0 and 2.7.1. It works on Xerces 2.2.1, 2.3.0, 2.4.0, 2.5.0, 2.6.0, 2.6.1 and 2.6.2. It also works on jaxp 1.2.2, jaxp 1.3.1 and JDK 1.5.
> This issue is very important for us because new validation API doesn't meet our performance requirements and requires JAXP 1.3 compatible parser (is less portable).

-- 
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: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


[jira] Resolved: (XERCESJ-1101) Validating DocumentBuilder instance fails to parse more than one XML document.

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XERCESJ-1101?page=all ]
     
Michael Glavassevich resolved XERCESJ-1101:
-------------------------------------------

    Resolution: Fixed

This was a reset bug which had been lurking in the code for several releases.  It surfaced after a performance improvement was made to the DOM parser in Xerces-J 2.7.0. Should be fixed in CVS now.  You can verify with the October 3rd build [1] or later.

[1] http://vmgump.apache.org/gump/public-jars/xml-xerces2/jars/

> Validating DocumentBuilder instance fails to parse more than one XML document.
> ------------------------------------------------------------------------------
>
>          Key: XERCESJ-1101
>          URL: http://issues.apache.org/jira/browse/XERCESJ-1101
>      Project: Xerces2-J
>         Type: Bug
>   Components: JAXP (javax.xml.parsers)
>     Versions: 2.7.0, 2.7.1
>     Reporter: Vojtech Habarta
>     Assignee: Michael Glavassevich
>     Priority: Critical
>  Attachments: ParsingTest.java, ParsingTest.xml, ParsingTest.xsd
>
> When DocumentBuilder instance with W3C XML Schema validation is created using JAXP 1.2 and is used for parsing it fails on second XML document.
> Here is sample code snippet:
>     DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
>     factory.setNamespaceAware(true);
>     factory.setValidating(true);
>     Object[] schemaSource = new Object[] {
>         // it is important to pass schemas as InputStreams to prevent schemas reparsing
>         ParsingTest.class.getResourceAsStream("ParsingTest.xsd"),
>     };
>     factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
>     factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaSource);
>     DocumentBuilder documentBuilder = factory.newDocumentBuilder();
>     documentBuilder.setErrorHandler(...);
>     documentBuilder.parse(new FileInputStream("C:\\ParsingTest.xml"));
>     System.out.println("OK");
>     documentBuilder.parse(new FileInputStream("C:\\ParsingTest.xml"));
>     System.out.println("OK");
> When this code is run it throws this exception:
> Exception in thread "main" org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'A'.
>         at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
>         at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>         at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
>         at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
>         at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
>         at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
>         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
>         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>         at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
>         at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
>         at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:76)
>         at test.ParsingTest.main(ParsingTest.java:34)
> This code fail on Xerces 2.7.0 and 2.7.1. It works on Xerces 2.2.1, 2.3.0, 2.4.0, 2.5.0, 2.6.0, 2.6.1 and 2.6.2. It also works on jaxp 1.2.2, jaxp 1.3.1 and JDK 1.5.
> This issue is very important for us because new validation API doesn't meet our performance requirements and requires JAXP 1.3 compatible parser (is less portable).

-- 
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: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


[jira] Updated: (XERCESJ-1101) Validating DocumentBuilder instance fails to parse more than one XML document.

Posted by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XERCESJ-1101?page=all ]

Michael Glavassevich updated XERCESJ-1101:
------------------------------------------

    Fix Version: 2.8.0
    Description: 
When DocumentBuilder instance with W3C XML Schema validation is created using JAXP 1.2 and is used for parsing it fails on second XML document.

Here is sample code snippet:

    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true);
    factory.setValidating(true);
    Object[] schemaSource = new Object[] {
        // it is important to pass schemas as InputStreams to prevent schemas reparsing
        ParsingTest.class.getResourceAsStream("ParsingTest.xsd"),
    };
    factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
    factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaSource);
    DocumentBuilder documentBuilder = factory.newDocumentBuilder();
    documentBuilder.setErrorHandler(...);
    documentBuilder.parse(new FileInputStream("C:\\ParsingTest.xml"));
    System.out.println("OK");
    documentBuilder.parse(new FileInputStream("C:\\ParsingTest.xml"));
    System.out.println("OK");

When this code is run it throws this exception:

Exception in thread "main" org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'A'.
        at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
        at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
        at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:76)
        at test.ParsingTest.main(ParsingTest.java:34)

This code fail on Xerces 2.7.0 and 2.7.1. It works on Xerces 2.2.1, 2.3.0, 2.4.0, 2.5.0, 2.6.0, 2.6.1 and 2.6.2. It also works on jaxp 1.2.2, jaxp 1.3.1 and JDK 1.5.

This issue is very important for us because new validation API doesn't meet our performance requirements and requires JAXP 1.3 compatible parser (is less portable).


  was:

When DocumentBuilder instance with W3C XML Schema validation is created using JAXP 1.2 and is used for parsing it fails on second XML document.

Here is sample code snippet:

    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true);
    factory.setValidating(true);
    Object[] schemaSource = new Object[] {
        // it is important to pass schemas as InputStreams to prevent schemas reparsing
        ParsingTest.class.getResourceAsStream("ParsingTest.xsd"),
    };
    factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
    factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaSource);
    DocumentBuilder documentBuilder = factory.newDocumentBuilder();
    documentBuilder.setErrorHandler(...);
    documentBuilder.parse(new FileInputStream("C:\\ParsingTest.xml"));
    System.out.println("OK");
    documentBuilder.parse(new FileInputStream("C:\\ParsingTest.xml"));
    System.out.println("OK");

When this code is run it throws this exception:

Exception in thread "main" org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'A'.
        at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
        at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
        at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
        at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:76)
        at test.ParsingTest.main(ParsingTest.java:34)

This code fail on Xerces 2.7.0 and 2.7.1. It works on Xerces 2.2.1, 2.3.0, 2.4.0, 2.5.0, 2.6.0, 2.6.1 and 2.6.2. It also works on jaxp 1.2.2, jaxp 1.3.1 and JDK 1.5.

This issue is very important for us because new validation API doesn't meet our performance requirements and requires JAXP 1.3 compatible parser (is less portable).



> Validating DocumentBuilder instance fails to parse more than one XML document.
> ------------------------------------------------------------------------------
>
>          Key: XERCESJ-1101
>          URL: http://issues.apache.org/jira/browse/XERCESJ-1101
>      Project: Xerces2-J
>         Type: Bug
>   Components: JAXP (javax.xml.parsers)
>     Versions: 2.7.0, 2.7.1
>     Reporter: Vojtech Habarta
>     Assignee: Michael Glavassevich
>     Priority: Critical
>      Fix For: 2.8.0
>  Attachments: ParsingTest.java, ParsingTest.xml, ParsingTest.xsd
>
> When DocumentBuilder instance with W3C XML Schema validation is created using JAXP 1.2 and is used for parsing it fails on second XML document.
> Here is sample code snippet:
>     DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
>     factory.setNamespaceAware(true);
>     factory.setValidating(true);
>     Object[] schemaSource = new Object[] {
>         // it is important to pass schemas as InputStreams to prevent schemas reparsing
>         ParsingTest.class.getResourceAsStream("ParsingTest.xsd"),
>     };
>     factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
>     factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaSource);
>     DocumentBuilder documentBuilder = factory.newDocumentBuilder();
>     documentBuilder.setErrorHandler(...);
>     documentBuilder.parse(new FileInputStream("C:\\ParsingTest.xml"));
>     System.out.println("OK");
>     documentBuilder.parse(new FileInputStream("C:\\ParsingTest.xml"));
>     System.out.println("OK");
> When this code is run it throws this exception:
> Exception in thread "main" org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'A'.
>         at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
>         at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>         at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
>         at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
>         at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
>         at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
>         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
>         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>         at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
>         at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
>         at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:76)
>         at test.ParsingTest.main(ParsingTest.java:34)
> This code fail on Xerces 2.7.0 and 2.7.1. It works on Xerces 2.2.1, 2.3.0, 2.4.0, 2.5.0, 2.6.0, 2.6.1 and 2.6.2. It also works on jaxp 1.2.2, jaxp 1.3.1 and JDK 1.5.
> This issue is very important for us because new validation API doesn't meet our performance requirements and requires JAXP 1.3 compatible parser (is less portable).

-- 
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: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


[jira] Updated: (XERCESJ-1101) Validating DocumentBuilder instance fails to parse more than one XML document.

Posted by "Vojtech Habarta (JIRA)" <xe...@xml.apache.org>.
     [ http://issues.apache.org/jira/browse/XERCESJ-1101?page=all ]

Vojtech Habarta updated XERCESJ-1101:
-------------------------------------

    Attachment: ParsingTest.java
                ParsingTest.xsd
                ParsingTest.xml

> Validating DocumentBuilder instance fails to parse more than one XML document.
> ------------------------------------------------------------------------------
>
>          Key: XERCESJ-1101
>          URL: http://issues.apache.org/jira/browse/XERCESJ-1101
>      Project: Xerces2-J
>         Type: Bug
>   Components: JAXP (javax.xml.parsers)
>     Versions: 2.7.0, 2.7.1
>     Reporter: Vojtech Habarta
>     Priority: Critical
>  Attachments: ParsingTest.java, ParsingTest.xml, ParsingTest.xsd
>
> When DocumentBuilder instance with W3C XML Schema validation is created using JAXP 1.2 and is used for parsing it fails on second XML document.
> Here is sample code snippet:
>     DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
>     factory.setNamespaceAware(true);
>     factory.setValidating(true);
>     Object[] schemaSource = new Object[] {
>         // it is important to pass schemas as InputStreams to prevent schemas reparsing
>         ParsingTest.class.getResourceAsStream("ParsingTest.xsd"),
>     };
>     factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
>     factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaSource);
>     DocumentBuilder documentBuilder = factory.newDocumentBuilder();
>     documentBuilder.setErrorHandler(...);
>     documentBuilder.parse(new FileInputStream("C:\\ParsingTest.xml"));
>     System.out.println("OK");
>     documentBuilder.parse(new FileInputStream("C:\\ParsingTest.xml"));
>     System.out.println("OK");
> When this code is run it throws this exception:
> Exception in thread "main" org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'A'.
>         at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
>         at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>         at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
>         at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
>         at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
>         at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
>         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
>         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>         at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
>         at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
>         at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:76)
>         at test.ParsingTest.main(ParsingTest.java:34)
> This code fail on Xerces 2.7.0 and 2.7.1. It works on Xerces 2.2.1, 2.3.0, 2.4.0, 2.5.0, 2.6.0, 2.6.1 and 2.6.2. It also works on jaxp 1.2.2, jaxp 1.3.1 and JDK 1.5.
> This issue is very important for us because new validation API doesn't meet our performance requirements and requires JAXP 1.3 compatible parser (is less portable).

-- 
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: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org