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

Document.createAttribute() returns an attribute with non-null localName

XMLWordPrintable

    • 1.1.1
    • generic
    • generic
    • Verified



      Name: inR10064 Date: 10/20/2000



        JAXP 1.1 method org.w3c.dom.Document.createAttribute(String name)
      returns an attribute with non-null local name (See test.java below).

        Definition of the method in p. 1.2 "Fundamental Interfaces" of DOM Level 2 Core
      (http://www.w3.org/TR/DOM-Level-2-Core/core.html#i-Document) says:

      " Return Value
          Attr A new Attr object with the nodeName attribute set to name, and localName,
                 prefix and namespaceURI set to null.
                 The value of the attribute is the empty string. "

      This bug presents in builds jaxp-1.1ea-b8 and jaxp-1.1fcs-b9 and affects the
      new test in TCK JAXP 1.1
      api/org_w3c_dom/Document/CreateAttributeTests.html#createAttributeTest01.

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

      public class test {
          
          public static void main(String argv[]) {
              
              try {
                  Document document = DocumentBuilderFactory.newInstance()
                                      .newDocumentBuilder().newDocument();
                  
                  Attr attr = document.createAttribute("a");
                  
                  System.out.println("Local Name: " + attr.getLocalName());
              } catch (Exception e) {
                  e.printStackTrace();
                  System.out.println("Unexpected " + e + " was thrown");
              }
          }
      }
      ---------------------------------------------------------------------------
      ---------------------------------------------------------------------------
      % java -version
      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)

      % java test
      Local Name: a
      ---------------------------------------------------------------------------

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

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: