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

Element.getSchemaTypeInfo() returns null if the document's schema is an XML DTD

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b32
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      Name: erR10175 Date: 12/09/2003


       
          If the document's schema is an XML DTD, the method

      org.w3c.dom.Element.getSchemaTypeInfo()

      returns null, but an instance of TypeInfo is expected.

      The documentation of the interface org.w3c.dom.TypeInfo reads:

      "If the document's schema is an XML DTD [XML 1.0], the values
      are computed as follows:

      - ...
      - If this type is referenced from an Element node, the
        typeNamespace and typeName are null."

      This implies that TypeInfo of the Element node is not null.

      This bug affects new tests in JCK 1.5 (not integrated yet)
         api/org_w3c/dom/TypeInfo/index.html#TypeInfo[GetTypeNamespace002]
         api/org_w3c/dom/TypeInfo/index.html#TypeInfo[GetTypeName003]

      The bug is found in jdk1.5.0/beta/b30.

      To reproduce the bug place test.java and test.xml to your current
      directory, then compile and run test.java as shown in the log below:
      ------------------------------------------ test.java
      import javax.xml.parsers.DocumentBuilderFactory;
      import org.w3c.dom.Document;

      class test {
          public static void main(String[] args) throws Exception {
              Document document = DocumentBuilderFactory
                  .newInstance().newDocumentBuilder().parse("test.xml");

              if(document.getDocumentElement().getSchemaTypeInfo() == null) {
                  System.out.println("getSchemaTypeInfo returns null");
              } else {
                  System.out.println("OK");
              }
          }
      }
      ----------------------------------------------------

      ------------------------------------------- test.xml
      <?xml version='1.0'?>
      <!DOCTYPE root [
          ELEMENT root (#PCDATA)
      ]>
      <root>xxx</root>
      ----------------------------------------------------

      ------------------------------------------------ log
      $javac test.java && java -cp . -showversion test
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b30)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b30, mixed mode)

      getSchemaTypeInfo returns null
      ----------------------------------------------------

      ======================================================================
      ###@###.### 2003-12-10

        Attachments

          Activity

            People

            Assignee:
            vkorcl Venugopal K (Inactive)
            Reporter:
            reysunw Rey Rey (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: