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

Document.createAttribute() returns an attribute with null value

    XMLWordPrintable

    Details

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

      Backports

        Description



        Name: eaR10174 Date: 03/19/2001


          The implementation of the method org.w3c.dom.Document.createAttribute() returns an
        attribute with null value (See test.java below). Created attribute should have an
        empty string as its value.

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

          "Returns:
                 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 appears in a build jaxp-1.1.1-b23-14_mar_2001.
           
        ------------------------------------test.java-----------------------------
        import org.w3c.dom.Document;
        import org.w3c.dom.Attr;
        import javax.xml.parsers.DocumentBuilderFactory;
        import javax.xml.parsers.DocumentBuilder;

        public class test {
            
            public static void main(String argv[]) {
                try {
                    Document document = DocumentBuilderFactory.newInstance()
                                            .newDocumentBuilder().newDocument();
                                       
                    Attr attr = document.createAttribute("a");
                    
                    System.out.println("Attribute value: " + attr.getValue());
                } catch (Exception e) {
                    System.out.println("Exception: " + e);
                }
            }
        }
        ---------------------------------------------------------------------------
        ---------------------------------------------------------------------------
        % java -showversion -cp .:jaxp1.1.1/jaxp.jar:jaxp1.1.1/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)

        Attribute value: null
        ---------------------------------------------------------------------------

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

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: