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

getLocalName() doesn't return null for elements and attributes created with DOM

    XMLWordPrintable

Details

    • 1.1.1
    • sparc
    • solaris_7
    • Verified

    Description



      Name: inR10064 Date: 12/18/2000


        
        JAXP 1.1 method org.w3c.dom.Node.getLocalName() doesn't return null for Element and Attr objects created
      with DOM Level 1 methods: createElement(String name), createAttribute(String name) (See test.java below).
        
          Definition of the attribute localName in p. 1.2 "Fundamental Interfaces" of DOM Level 2 Core
      (http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1950641247) reads:

      " localName of type DOMString, readonly, introduced in DOM Level 2
            Returns the local part of the qualified name of this node.
            For nodes of any type other than ELEMENT_NODE and ATTRIBUTE_NODE and nodes created with a DOM Level 1
            method, such as createElement from the Document interface, this is always null. "

        This bug is found in builds jaxp-1.1ea-b07, jaxp-1.1ea-b08, jaxp-1.1ea-b09,
      jaxp-1.1ea2-b10, jaxp-1.1ea2-b11, jaxp-1.1ea2-b12, jaxp-1.1ea2-b13, jaxp-1.1ea2-b14,
      jaxp-1.1ea2-b15 and affects the new test in TCK JAXP 1.1:

      api/org_w3c_dom/Node/GetLocalNameTests.html#getLocalNameTest01

      ------------------------------------test.java-----------------------------
      import org.w3c.dom.Document;
      import org.w3c.dom.Node;
      import javax.xml.parsers.DocumentBuilderFactory;
      import javax.xml.parsers.DocumentBuilder;

      public class test {
          
          public static void main(String argv[]) {
              
              try {
                  DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance()
                                                    .newDocumentBuilder();

                  Document document = documentBuilder.newDocument();

                  Node element = document.createElement("element");

                  Node attr = document.createAttribute("attr");
              
                  System.out.println("Local name of element: " + element.getLocalName());
                  System.out.println("Local name of attribute: " + attr.getLocalName());
              } catch (Exception e) {
                  e.printStackTrace();
                  System.out.println("Unexpected exception: " + e);
              }
          }
      }
      ---------------------------------------------------------------------------
      ---------------------------------------------------------------------------
      % java -showversion -cp .:jaxp1.1ea/jaxp.jar:jaxp1.1ea/crimson.jar test
      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, interpreted mode)

      Local name of element: element
      Local name of attribute: attr
      ---------------------------------------------------------------------------
            
      ======================================================================

      Attachments

        Activity

          People

            egoei Edwin Goei (Inactive)
            inevsunw Inev Inev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: