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

DOMImplementationLS.createDOMParser throws exception

XMLWordPrintable

    • b49
    • sparc
    • solaris_2.6

        Name: sdR10048 Date: 09/26/2003


        Filed By : SPB JCK team (###@###.###)
        JDK : java full version "1.5.0-beta-b20"
        JCK : 1.5
        Tests fail(s):
            api/org_w3c/dom/ls/DOMImplementationLS/index.html#create[create0003]

        Currently (26 sep 2003) this test is not in WS. Will be there soon.

        Specification excerpt:
        ======================
        --------- J2SE API spec v.1.5 ---------
        ...
        public DOMParser createDOMParser(short mode,
                                         java.lang.String schemaType)
                                  throws org.w3c.dom.DOMException
        . . .
        Note: For W3C XML Schema [XML Schema Part 1] , applications must use the value
        "http://www.w3.org/2001/XMLSchema". For XML DTD [XML 1.0], applications must
        use the value "http://www.w3.org/TR/REC-xml". Other Schema languages are
        utside the scope of the W3C and therefore should recommend an absolute URI in
        order to use this method.

        ...
        ---------- end-of-excerpt ---------------

        Problem description
        ===================
        The designated method does throw XMLConfigurationException in case
        we provide "http://www.w3.org/TR/REC-xml" as schemaType.
        See demo.
            
        Minimized test:
        ===============
        ------- T.java -------
        import org.w3c.dom.*;
        import org.w3c.dom.ls.*;
        import javax.xml.parsers.*;
        import java.io.*;

        public class T {

            static String xml1 = "<ROOT><ELEMENT1></ELEMENT1></ROOT>";

            public static String schemaType =
                "http://www.w3.org/TR/REC-xml";

            public static void main(String[] args) {
                    Document doc = null;
                    DocumentBuilder parser = null;
                    DOMImplementationLS implLS = null;
                    try {
                        parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                        StringBufferInputStream is = new StringBufferInputStream(xml1);
                        doc = parser.parse(is);
                    } catch (Exception e) {
                        e.printStackTrace();
                        return;
                    }
                    DOMImplementation impl = doc.getImplementation();
                    implLS = (DOMImplementationLS) impl.getFeature("LS","3.0");
                    System.out.println("DOMImplementationLS: " + implLS);
                    System.out.println("DOMParser: " +
                        implLS.createDOMParser(DOMImplementationLS.MODE_SYNCHRONOUS,
                                               schemaType));
            }
        }

        ------- end-of-T.java -------

        Minimized test output:
        ======================
        DOMImplementationLS: com.sun.org.apache.xerces.internal.dom.CoreDOMImplementatio
        nImpl@1ded0fd
        Exception in thread "main" com.sun.org.apache.xerces.internal.xni.parser.XMLConf
        igurationException: http://apache.org/xml/features/validation/schema/normalized-
        value
                at com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings.c
        heckFeature(ParserConfigurationSettings.java:297)
                at com.sun.org.apache.xerces.internal.parsers.DTDConfiguration.checkFeat
        ure(DTDConfiguration.java:796)
                at com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings.s
        etFeature(ParserConfigurationSettings.java:175)
                at com.sun.org.apache.xerces.internal.parsers.BasicParserConfiguration.s
        etFeature(BasicParserConfiguration.java:488)
                at com.sun.org.apache.xerces.internal.parsers.DOMParserImpl.<init>(DOMPa
        rserImpl.java:227)
                at com.sun.org.apache.xerces.internal.parsers.DOMParserImpl.<init>(DOMPa
        rserImpl.java:164)
                at com.sun.org.apache.xerces.internal.dom.CoreDOMImplementationImpl.crea
        teDOMParser(CoreDOMImplementationImpl.java:349)
                at T.main(T.java:28)


        ======================================================================

              rmandavasunw Ramesh Mandava (Inactive)
              dsvsunw Dsv Dsv (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: