jaxp
  1. jaxp
  2. JAXP-46

Namespace problem when using DOMSource for schema validation

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: current
    • Fix Version/s: milestone 1
    • Component/s: www
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      46

      Description

      When a valid DOMSource is passed for schema validation, it doesn't find some
      namespaces. Attaching a testcase for this. It works for the StreamSource but not
      for DOMSource.

        Activity

        Hide
        jitu added a comment -

        Created an attachment (id=14)
        test case

        Show
        jitu added a comment - Created an attachment (id=14) test case
        Hide
        Santiago Pericas-Geertsen added a comment -

        I've created a unit test from the your test case, but it ran without any exceptions. I also printed out the
        DOM and noticed that it was identical to 'instance.xml'. What's the exception that you're getting? Can you
        try to install the latest JAXP on your JDK to see if you can reproduce the problem?

        Show
        Santiago Pericas-Geertsen added a comment - I've created a unit test from the your test case, but it ran without any exceptions. I also printed out the DOM and noticed that it was identical to 'instance.xml'. What's the exception that you're getting? Can you try to install the latest JAXP on your JDK to see if you can reproduce the problem?
        Hide
        jitu added a comment -

        $ java -version
        java version "1.5.0_12"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
        Java HotSpot(TM) Server VM (build 1.5.0_12-b04, mixed mode)

        $ java ValidatorTest
        ERROR: 'UndeclaredPrefix: Cannot resolve 'ns2:toyota' as a QName: the prefix
        'ns2' is not declared.'
        Exception in thread "main" org.xml.sax.SAXParseException: UndeclaredPrefix:
        Cannot resolve 'ns2:toyota' as a QName: the prefix 'ns2' is not declared.
        at
        com.sun.org.apache.xerces.internal.jaxp.validation.Util.toSAXParseException(Util.java:109)
        at
        com.sun.org.apache.xerces.internal.jaxp.validation.ErrorHandlerAdaptor.error(ErrorHandlerAdaptor.java:104)
        at
        com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382)
        at
        com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
        at
        com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:429)
        at
        com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3185)
        at
        com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.getAndCheckXsiType(XMLSchemaValidator.java:2485)
        at
        com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1979)
        at
        com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:705)
        at
        com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(ValidatorHandlerImpl.java:335)
        at
        com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandler.java:205)
        at
        com.sun.org.apache.xml.internal.serializer.ToSAXHandler.flushPending(ToSAXHandler.java:291)
        at
        com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.startElement(ToXMLSAXHandler.java:646)
        at
        com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.startElement(ToXMLSAXHandler.java:501)
        at
        com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:138)
        at
        com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:215)
        at
        com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:215)
        at
        com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:121)
        at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:85)
        at
        com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:615)
        at
        com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:661)
        at
        com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:300)
        at
        com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.process(ValidatorImpl.java:220)
        at
        com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:141)
        at javax.xml.validation.Validator.validate(Validator.java:82)
        at ValidatorTest.validate(ValidatorTest.java:46)
        at ValidatorTest.main(ValidatorTest.java:51)
        [/home/jk144508/bugs/validation/case4]

        I am using latest JDK. I will try using latest JAXP.

        Show
        jitu added a comment - $ java -version java version "1.5.0_12" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04) Java HotSpot(TM) Server VM (build 1.5.0_12-b04, mixed mode) $ java ValidatorTest ERROR: 'UndeclaredPrefix: Cannot resolve 'ns2:toyota' as a QName: the prefix 'ns2' is not declared.' Exception in thread "main" org.xml.sax.SAXParseException: UndeclaredPrefix: Cannot resolve 'ns2:toyota' as a QName: the prefix 'ns2' is not declared. at com.sun.org.apache.xerces.internal.jaxp.validation.Util.toSAXParseException(Util.java:109) at com.sun.org.apache.xerces.internal.jaxp.validation.ErrorHandlerAdaptor.error(ErrorHandlerAdaptor.java:104) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:429) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3185) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.getAndCheckXsiType(XMLSchemaValidator.java:2485) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1979) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:705) at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.startElement(ValidatorHandlerImpl.java:335) at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandler.java:205) at com.sun.org.apache.xml.internal.serializer.ToSAXHandler.flushPending(ToSAXHandler.java:291) at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.startElement(ToXMLSAXHandler.java:646) at com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.startElement(ToXMLSAXHandler.java:501) at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:138) at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:215) at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:215) at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:121) at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:85) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:615) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:661) at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:300) at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.process(ValidatorImpl.java:220) at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:141) at javax.xml.validation.Validator.validate(Validator.java:82) at ValidatorTest.validate(ValidatorTest.java:46) at ValidatorTest.main(ValidatorTest.java:51) [/home/jk144508/bugs/validation/case4] I am using latest JDK. I will try using latest JAXP.
        Hide
        jitu added a comment -

        It works with JDK 1.6.0_03 but not with JDK 1.5.0_12
        Many JAX-WS users use JDK 1.5.0

        Show
        jitu added a comment - It works with JDK 1.6.0_03 but not with JDK 1.5.0_12 Many JAX-WS users use JDK 1.5.0
        Hide
        Joe Wang added a comment -

        I have also created a CR to be used for jdk5 integration. Refer to 6626853.

        Show
        Joe Wang added a comment - I have also created a CR to be used for jdk5 integration. Refer to 6626853.
        Hide
        Joe Wang added a comment -

        This is fixed in Jaxp 1.4 on java.net and included in the nightly build. We
        have made a request to have this patch integrated in future jdk update releases.

        Show
        Joe Wang added a comment - This is fixed in Jaxp 1.4 on java.net and included in the nightly build. We have made a request to have this patch integrated in future jdk update releases.

          People

          • Assignee:
            Joe Wang
            Reporter:
            jitu
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: