Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6626853

Namespace problem when using DOMSource for schema validation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.3.0
    • 5.0
    • xml

        JAXP Issue 46:

        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.

        ------- Additional comments from jitu Sat Oct 20 00:53:32 +0000 2007 -------

        Created an attachment (id=14)
        test case

        ------- Additional comments from spericas Mon Oct 22 19:02:16 +0000 2007 -------

        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?

        ------- Additional comments from jitu Mon Oct 22 20:35:19 +0000 2007 -------

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

        ------- Additional comments from jitu Mon Oct 22 20:53:59 +0000 2007 -------

        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

              joehw Joe Wang
              joehw Joe Wang
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: