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

Document.createElement() returns an element with non-null localName

    XMLWordPrintable

    Details

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

      Description



      Name: inR10064 Date: 10/20/2000



        JAXP 1.1 method org.w3c.dom.Document.createElement(String tagName)
      returns an element 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
          Element A new Element object with the nodeName attribute set to tagName,
                    and localName, prefix and namespaceURI set to null. "

      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/CreateElementTests.html#createElementTest01.

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

      public class test1 {
          
          public static void main(String argv[]) {
              
              try {
                  Document document = DocumentBuilderFactory.newInstance()
                                      .newDocumentBuilder().newDocument();
                  
                  Element element = document.createElement("a");
                  
                  System.out.println("Local Name: " + element.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
      ---------------------------------------------------------------------------

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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: