This page contains the XML for <SCRIPT> DOMElement object documentation.
                    
                    
                        Return to W3C DOM Parser Documentation Main Page
                    
                    
                        NOTE: DOMElement descends from
                        DOMNode and inherits
                        all of the properties and methods of the DOMNode object
                    
                    
                        - 
                            CONTENTS
                         
                        - 
                            DOMElement - object description
                        
 
                        - 
                             
                        
 
                        - 
                            
                                - 
                                    Native Methods:
                                
 
                                - 
                                    DOMElement - getTagName method
                                
 
                                - 
                                    DOMElement - getAttribute method
                                
 
                                - 
                                    DOMElement - setAttribute method
                                
 
                                - 
                                    DOMElement - removeAttribute method
                                
 
                                - 
                                    DOMElement - getAttributeNode method
                                
 
                                - 
                                    DOMElement - setAttributeNode method
                                
 
                                - 
                                    DOMElement - removeAttributeNode method
                                
 
                                - 
                                    DOMElement - hasAttribute method
                                
 
                                - 
                                    DOMElement - getAttributeNS method
                                
 
                                - 
                                    DOMElement - setAttributeNS method
                                
 
                                - 
                                    DOMElement - removeAttributeNS method
                                
 
                                - 
                                    DOMElement - getAttributeNodeNS method
                                
 
                                - 
                                    DOMElement - setAttributeNodeNS method
                                
 
                                - 
                                    DOMElement - hasAttributeNS methood
                                
 
                                - 
                                    DOMElement - getElementsByTagName
                                
 
                                - 
                                    DOMElement - getElementsByTagNameNS
                                
 
                            
                         
                        - 
                             
                        
 
                        - 
                            
                                - 
                                    Inherited Methods:
                                
 
                                - 
                                    DOMNode - getNodeName method
                                
 
                                - 
                                    DOMNode - getNodeValue method
                                
 
                                - 
                                    DOMNode - setNodeValue method
                                
 
                                - 
                                    DOMNode - getNodeType method
                                
 
                                - 
                                    DOMNode - getParentNode method
                                
 
                                - 
                                    DOMNode - getChildNodes method
                                
 
                                - 
                                    DOMNode - getFirstChild method
                                
 
                                - 
                                    DOMNode - getLastChild method
                                
 
                                - 
                                    DOMNode - getPreviousSibling method
                                
 
                                - 
                                    DOMNode - getNextSibling method
                                
 
                                - 
                                    DOMNode - getAttributes method
                                
 
                                - 
                                    DOMNode - getNamespaceURI method
                                
 
                                - 
                                    DOMNode - getPrefix method
                                
 
                                - 
                                    DOMNode - getLocalName method
                                
 
                                - 
                                    DOMNode - getOwnerDocument method
                                
 
                                - 
                                    DOMNode - insertBefore method
                                
 
                                - 
                                    DOMNode - replaceChild method
                                
 
                                - 
                                    DOMNode - removeChild method
                                
 
                                - 
                                    DOMNode - appendChild method
                                
 
                                - 
                                    DOMNode - hasChildNodes method
                                
 
                                - 
                                    DOMNode - cloneNode method
                                
 
                                - 
                                    DOMNode - getElementsByTagName method
                                
 
                                - 
                                    DOMNode - getElementsByTagNameNS method
                                
 
                                - 
                                    DOMNode - setPrefix method
                                
 
                                - 
                                    DOMNode - normalize method
                                
 
                                - 
                                    DOMNode - isSupported method
                                
 
                                - 
                                    DOMNode - getXML method
                                
 
                                - 
                                    DOMNode - hasAttributes method
                                
 
                            
                         
                    
                    
                    
                    
                        DOMElement - object description
                    
                    
                        The DOMElement interface represents an element in an XML document.
                        Elements may have attributes associated with them; since the DOMElement
                        interface inherits from DOMNode, the generic DOMNode interface attribute
                        attributes may be used to retrieve the set of all attributes for an element.
                        There are methods on the DOMElement interface to retrieve either a DOMAttr
                        object by name or an attribute value by name.
                    
                    
                    
                    
                    
                        DOMElement - getTagName method
                    
                    
                        W3C DOM Level 1 and Level 2 (namespaces)
                    
                    
                        domElement.getTagName();
                    
                    accepts:
                    
                        N/A
                    
                    
                    returns:
                    
                        String - the tag name of the element
                    
                    
                    throws:
                    
                        N/A
                    
                    
                        The getTagName method will return the name of the element. For XML streams that
                        use namespaces, the value returned will be a fully qualified name (i.e. a QNAME)
                        that includes the namespace information.
                    
                    
                        Example:
                    
                    
                        function xmljsDOMExample() {
                        
                            var xml;
                            xml = ""
                            + "<?xml version=\"1.0\"?>"
                            + "<ROOT>"
                            + "<ns1:TAG1 xmlns:ns1=\"http://xmljs.sf.net/ns1\">"
                            + "Hello World"
                            + "</ns1:TAG1>"
                            + "</ROOT>";
                            
                            //instantiate the W3C DOM Parser
                            var parser = new DOMImplementation();
                            
                            //load the XML into the parser and get the DOMDocument
                            var domDoc = parser.loadXML(xml);
                            
                            //get the document root
                            var docRoot = domDoc.getDocumentElement();
                            
                            //get the TAG1 node
                            var tag1 = docRoot.getFirstChild();
                            
                            //the following should be "ROOT"
                            alert(docRoot.getTagName());
                            
                            //get the TAG1 node (with its namespace information)
                            var tag1 = docRoot.getFirstChild();
                            
                            //the following should be "ns1:TAG1"
                            alert(tag1.getTagName());
                            
                        
                        }// end function xmljsDOMExample
                        
                    
 
                    
                    
                    
                    
                        DOMElement - getAttribute method
                    
                    
                        W3C DOM Level 1
                    
                    
                        domElement.getAttribute(<attributeName>);
                    
                    accepts:
                    
                        String attributeName - the name of the attribute to return
                    
                    
                    returns:
                    
                        String - the value of the queried attribute or "" if the attribute is not found
                    
                    
                    throws:
                    
                        N/A
                    
                    
                        The getAttribute method will return the value of the attribute who's name is passed
                        into the method. If the name is not found, getAttribute will return a blank (empty)
                        string.
                    
                    
                        NOTE: To get an attribute from within a namespace,
                        use the getAttributeNS method.
                    
                    
                        Example:
                    
                    
                        function xmljsDOMExample() {
                        
                            var xml;
                            xml = ""
                            + "<?xml version=\"1.0\"?>"
                            + "<ROOT id=\"root\">"
                            + "<TAG1 foo=\"fooValue\">"
                            + "Hello World"
                            + "</TAG1>"
                            + "</ROOT>";
                            
                            //instantiate the W3C DOM Parser
                            var parser = new DOMImplementation();
                            
                            //load the XML into the parser and get the DOMDocument
                            var domDoc = parser.loadXML(xml);
                            
                            //get ROOTNODE by its id
                            var rootNode = domDoc.getElementById("root");
                            
                            //get the TAG1 node
                            var tag1 = rootNode.getFirstChild();
                            
                            //the following should be "fooValue"
                            alert(tag1.getAttribute("foo"));
                            
                        
                        }// end function xmljsDOMExample
                        
                    
 
                    
                    
                    
                    
                        DOMElement - setAttribute method
                    
                    
                        W3C DOM Level 1
                    
                    
                        domElement.setAttribute(<attributeName>, <attribteValue>);
                    
                    accepts:
                    
                        String attributeName - the name of the attribute add or modify
                        String attributeValue - the value to assign the attribute
                    
                    
                    returns:
                    
                        N/A
                    
                    
                    throws:
                    
                    
                        The setAttribute method adds or updates an attribute. If an attribute with
                        <attributeName> is already present in the element, its value is changed
                        to be that of the <attributeValue> parameter.
                    
                    
                        NOTE: To set an attribute within a namespace,
                        use the setAttributeNS method.
                    
                    
                        Example:
                    
                    
                        function xmljsDOMExample() {
                        
                            var xml;
                            xml = ""
                            + "<?xml version=\"1.0\" ?>"
                            + "<ROOT id=\"root\">"
                            + "<TAG1 foo=\"fooValue\">"
                            + "Hello World"
                            + "</TAG1>"
                            + "</ROOT>";
                            
                            //instantiate the W3C DOM Parser
                            var parser = new DOMImplementation();
                            
                            //load the XML into the parser and get the DOMDocument
                            var domDoc = parser.loadXML(xml);
                            
                            //get ROOTNODE by its id
                            var rootNode = domDoc.getElementById("root");
                            
                            //get TAG1
                            var tag1 = rootNode.getFirstChild();
                            
                            //the following should be "fooValue"
                            alert(tag1.getAttribute("foo"));
                            
                            //set the "foo" attribute's value to "newFooValue"
                            tag1.setAttribute("foo", "newFooValue");
                            
                            //create a new attribute called "newAttrib"
                            //with a value of "newAttribValue"
                            tag1.setAttribute("newAttrib", "newAttribValue");
                            
                            //the following should be
                            //"<TAG1 foo="newFooValue" newAttrib="newAttribValue">
                            //Hello World
                            //</TAG1>"
                            alert(tag1.getXML());
                            
                        
                        }// end function xmljsDOMExample
                        
                    
 
                    
                    
                    
                    
                        DOMElement - removeAttribute method
                    
                    
                        W3C DOM Level 1
                    
                    
                        domElement.removeAttribute(<attributeName>);
                    
                    accepts:
                    
                        String attributeName - the name of the attribute to remove
                    
                    
                    returns:
                    
                        DOMAttr - the DOMAttr that was removed or null if not found
                    
 
                    
                    throws:
                    
                    
                        The removeAttribute method removes the attribute specified by <attributeName>
                        from the DOMElement.
                    
                    
                        NOTE: To remove an attribute from within a namespace,
                        use the removeAttributeNS method.
                    
                    
                        Example:
                    
                    
                        function xmljsDOMExample() {
                        
                            var xml;
                            xml = ""
                            + "<?xml version=\"1.0\" ?>"
                            + "<ROOT id=\"root\">"
                            + "<TAG1 foo=\"fooValue\">"
                            + "Hello World"
                            + "</TAG1>"
                            + "</ROOT>";
                            
                            //instantiate the W3C DOM Parser
                            var parser = new DOMImplementation();
                            
                            //load the XML into the parser and get the DOMDocument
                            var domDoc = parser.loadXML(xml);
                            
                            //get ROOTNODE by its id
                            var rootNode = domDoc.getElementById("root");
                            
                            //get TAG1
                            var tag1 = rootNode.getFirstChild();
                            
                            //the following should be "fooValue"
                            alert(tag1.getAttribute("foo"));
                            
                            //remove the "foo" attribute
                            var retVal = tag1.removeAttribute("foo");
                            
                            //the following should be "fooValue"
                            alert(retVal.getValue());
                            
                            //the following should be
                            //<TAG1>
                            //Hello World
                            //</TAG1>
                            alert(tag1.getXML());
                            
                        
                        }// end function xmljsDOMExample
                        
                    
 
                    
                    
                    
                    
                        DOMElement - getAttributeNode method
                    
                    
                        W3C DOM Level 1
                    
                    
                        domElement.getAttributeNode(<attributeName>);
                    
                    accepts:
                    
                        String attributeName - the name of the attribute to return
                    
                    
                    returns:
                    
                        DOMAttr - the attribute corresponding to <attributeName>
                    
 
                    
                    throws:
                    
                        N/A
                    
                    
                        The getAttributeNode method will return the DOMAttr object representing the attribute
                        that corresponds to the <attributeName> passed in. If no attribute that corresponds
                        to <attributeName> is found, getAttributeNode will return null.
                    
                    
                        NOTE: To retrieve an attribute from within a namespace,
                        use the getAttributeNodeNS method.
                    
                    
                        Example:
                    
                    
                        function xmljsDOMExample() {
                        
                            var xml;
                            xml = ""
                            + "<?xml version=\"1.0\" ?>"
                            + "<ROOT id=\"root\">"
                            + "<TAG1 foo=\"fooValue\">"
                            + "Hello World"
                            + "</TAG1>"
                            + "</ROOT>";
                            
                            //instantiate the W3C DOM Parser
                            var parser = new DOMImplementation();
                            
                            //load the XML into the parser and get the DOMDocument
                            var domDoc = parser.loadXML(xml);
                            
                            //get ROOTNODE by its id
                            var rootNode = domDoc.getElementById("root");
                            
                            //get the TAG1 node
                            var tag1 = rootNode.getFirstChild();
                            
                            //get the DOMAttr that represents the "foo" attribute
                            var domAttr = tag1.getAttributeNode("foo");
                            
                            //the following should be "fooValue"
                            alert(domAttr.getValue());
                            
                            //search for an attribute that does not exist
                            var notThere = tag1.getAttributeNode("notThere");
                            
                            //the following should be "true"
                            alert(notThere == null);
                            
                        
                        }// end function xmljsDOMExample
                        
                    
 
                    
                    
                    
                    
                        DOMElement - setAttributeNode method
                    
                    
                        W3C DOM Level 1
                    
                    
                        domElement.setAttributeNode(<newAttribute>);
                    
                    accepts:
                    
                        DOMAttr newAttribute - the DOMAttr object to be added to the element
                    
 
                    
                    returns:
                    
                        DOMAttr - the replaced DOMAttr object or null if the DOMAttr was successfully added to the DOMElement
                    
 
                    
                    throws:
                    
                    
                        The setAttributeNode method adds or updates an attribute in a DOMElement.
                        If a DOMAttr exists within the DOMElement with the same name as the name in the
                        DOMAttr object passed in, that DOMAttr object is replaced with the new DOMAttr.
                        Otherwise, the new DOMAttr object is simply added to the DOMElement.
                    
                    
                        If the new DOMAttr object replaces a DOMAttr object in the DOMElement, the replaced
                        DOMAttr object is returned. Otherwise, setAttributeNode returns null.
                    
                    
                        NOTE: To set an attribute within a namespace,
                        use the setAttributeNodeNS method.
                    
                    
                        Example:
                    
                    
                        function xmljsDOMExample() {
                        
                            var xml;
                            xml = ""
                            + "<?xml version=\"1.0\" ?>"
                            + "<ROOT>"
                            + "<TAG1>"
                            + "Hello"
                            + "</TAG1>"
                            + "</ROOT>";
                            
                            //instantiate the W3C DOM Parser
                            var parser = new DOMImplementation();
                            
                            //load the XML into the parser and get the DOMDocument
                            var domDoc = parser.loadXML(xml);
                            
                            //get the root node
                            var docRoot = domDoc.getDocumentElement();
                            
                            //get the "TAG1" element
                            var tag1 = docRoot.getElementsByTagName("TAG1").item(0);
                            
                            //create a new DOMAttr node
                            var newAttribute = domDoc.createAttribute("attribute");
                            
                            //set the attribute's value
                            newAttribute.setNodeValue("value1");
                            
                            //add the attribute to the DOMElement
                            var retVal = tag1.setAttributeNode(newAttribute);
                            
                            //the following should be "true" since the
                            //attribute did not replace another in the
                            //DOMElement
                            alert(retVal==null);
                            
                            //create another attribute, with the same name
                            var newAttribute2 = domDoc.createAttribute("attribute");
                            
                            //set it's value
                            newAttribute2.setNodeValue("value2");
                            
                            //now add this new attribute to the DOMElement
                            //it should replace the first DOMAttr and return it
                            retVal = tag1.setAttributeNode(newAttribute2);
                            
                            //make sure we got the correct DOMAttr back and that
                            //the document has been correctly modified
                            //the DOMAttr we get back should be newAttribute
                            
                            //the following should be "true"
                            alert(retVal == newAttribute);
                            
                            //the following should be
                            //<?xml version="1.0"?>
                            //<ROOT>
                            //<TAG1 attribute="value2">
                            //Hello
                            //</TAG1>
                            //</ROOT>"
                            alert(domDoc.getXML());
                            
                        
                        }// end function xmljsDOMExample
                        
                    
 
                    
                    
                    
                    
                        DOMElement - removeAttributeNode method
                    
                    
                        W3C DOM Level 1
                    
                    
                        domElement.removeAttributeNode(<attributeNode>);
                    
                    accepts:
                    
                        DOMAttr - the DOMAttr to remove from the element
                    
 
                    
                    returns:
                    
                        DOMAttr - the attribute that was removed
                    
 
                    
                    throws:
                    
                    
                        The removeAttributeNode method will remove the attribute specified by <attributeNode>
                        from the DOMElement.
                    
                    
                        NOTE: To remove an attribute within a namespace,
                        use the removeAttributeNS method.
                    
                    
                        Example:
                    
                    
                        function xmljsDOMExample() {
                        
                            var xml;
                            xml = ""
                            + "<?xml version=\"1.0\" ?>"
                            + "<ROOT id=\"root\">"
                            + "<TAG1 foo=\"fooValue\">"
                            + "Hello World"
                            + "</TAG1>"
                            + "</ROOT>";
                            
                            //instantiate the W3C DOM Parser
                            var parser = new DOMImplementation();
                            
                            //load the XML into the parser and get the DOMDocument
                            var domDoc = parser.loadXML(xml);
                            
                            //get ROOTNODE by its id
                            var rootNode = domDoc.getElementById("root");
                            
                            //get the TAG1 node
                            var tag1 = rootNode.getFirstChild();
                            
                            //get the DOMAttr that represents the "foo" attribute
                            var domAttr = tag1.getAttributeNode("foo");
                            
                            //now remove it from the DOMElement
                            var retVal = tag1.removeAttributeNode(domAttr);
                            
                            //retVal is the removed attribute, in this
                            //case it should be equal to domAttr. Check and
                            //make sure this is true
                            
                            //the following should be "true"
                            alert(retVal == domAttr);
                            
                            //with the attribute removed,
                            //the following should be
                            //<TAG1>
                            //Hello World
                            //</TAG1>
                            alert(tag1.getXML());
                            
                        
                        }// end function xmljsDOMExample
                        
                    
 
                    
                    
                    
                    
                        DOMElement - hasAttribute method
                    
                    
                        W3C DOM Level 1
                    
                    
                        domElement.hasAttribute(<attributeName>);
                    
                    accepts:
                    
                        String attributeName - the attribute who's existance is to be queried
                    
                    
                    returns:
                    
                        boolean - true if the attribute exists, false otherwise
                    
                    
                    throws:
                    
                        N/A
                    
                    
                        The hasAttribute method provides a simple way to query a DOMElement to
                        determine if it has an attribute with the name specified.
                    
                    
                        NOTE: To query for an attribute within a namespace,
                        use the hasAttributeNS method.
                    
                    
                        Example:
                    
                    
                        function xmljsDOMExample() {
                        
                            var xml;
                            xml = ""
                            + "<?xml version=\"1.0\" ?>"
                            + "<ROOT id=\"root\">"
                            + "<TAG1 foo=\"fooValue\">"
                            + "Hello World"
                            + "</TAG1>"
                            + "</ROOT>";
                            
                            //instantiate the W3C DOM Parser
                            var parser = new DOMImplementation();
                            
                            //load the XML into the parser and get the DOMDocument
                            var domDoc = parser.loadXML(xml);
                            
                            //get ROOTNODE by its id
                            var rootNode = domDoc.getElementById("root");
                            
                            //get the TAG1 node
                            var tag1 = rootNode.getFirstChild();
                            
                            //the following should be "true"
                            alert(tag1.hasAttribute("foo"));
                            
                            //the following should be "false"
                            alert(tag1.hasAttribute("notThere"));
                            
                        
                        }// end function xmljsDOMExample
                        
                    
 
                    
                    
                    
                    
                        DOMElement - getAttributeNS method
                    
                    
                        W3C DOM Level 2
                    
                    
                        domElement.getAttributeNS(<namespaceURI>, <localName>);
                    
                    accepts:
                    
                        String namespaceURI - The namespace to search in
                        String localName - the attribute name to search for
                    
                    
                    returns:
                    
                        String - the value of the queried attribute or "" if the attribute is not found
                    
                    
                    throws:
                    
                        N/A
                    
                    
                        The getAttributeNS method will return the value of the attribute in the
                        specified namespace who's name is passed into the method. If the name
                        is not found in the namespace, getAttributeNS will return a blank (empty)
                        string.
                    
                    
                        Example:
                    
                    
                        function xmljsDOMExample() {
                        
                            var xml;
                            xml = ""
                            + "<?xml version=\"1.0\" ?>"
                            + "<ns1:ROOT xmlns:ns1=\"http://xmljs.sf.net/ns1\" >"
                            + "<ns1:TAG1 ns1:foo=\"fooValue\">"
                            + "Hello World"
                            + "</ns1:TAG1>"
                            + "</ns1:ROOT>";
                            
                            //instantiate the W3C DOM Parser
                            var parser = new DOMImplementation();
                            
                            //load the XML into the parser and get the DOMDocument
                            var domDoc = parser.loadXML(xml);
                            
                            //get ROOTNODE 
                            var rootNode = domDoc.getDocumentElement();
                            
                            //get the TAG1 node
                            var tag1 = rootNode.getFirstChild();
                            
                            //get the attribute value in the
                            //http://xmljs.sf.net/ns1 namespace with the
                            //local name of "foo"
                            var ns1 = "http://xmljs.sf.net/ns1";
                            var retVal = tag1.getAttributeNS(ns1, "foo");
                            
                            //the following should be "fooValue"
                            alert(retVal);
                             
                        
                        }// end function xmljsDOMExample
                        
                    
 
                    
                    
                    
                    
                        DOMElement - setAttributeNS method
                    
                    
                        W3C DOM Level 2
                    
                    
                        domElement.setAttributeNS(<namespaceURI>, <QName>, <value>);
                    
                    accepts:
                    
                        String namespaceURI - The namespace to insert the new attribute into
                        String QName - the fully qualified name (<prefix>:<localName>) of the attribute
                        String value - the value of the new attribute
                    
                    
                    returns:
                    
                        N/A
                    
                    
                    throws:
                    
                    
                        The setAttributeNS method adds or updates an attribute in the specified namespace.
                        If an attribute with <QName> is already present in the element
                        in the specified namespace, its value is changed to be that of the <value> parameter.
                    
                    
                        Example:
                    
                    
                        function xmljsDOMExample() {
                        
                            var xml;
                            xml = ""
                            + "<?xml version=\"1.0\" ?>"
                            + "<ns1:ROOT xmlns:ns1=\"http://xmljs.sf.net/ns1\" >"
                            + "<ns1:TAG1 ns1:foo=\"origValue\">"
                            + "Hello World"
                            + "</ns1:TAG1>"
                            + "</ns1:ROOT>";
                            
                            //instantiate the W3C DOM Parser
                            var parser = new DOMImplementation();
                            
                            //load the XML into the parser and get the DOMDocument
                            var domDoc = parser.loadXML(xml);
                            
                            //get ROOTNODE 
                            var rootNode = domDoc.getDocumentElement();
                            
                            //get the TAG1 node
                            var tag1 = rootNode.getFirstChild();
                            
                            //the following should be "origValue"
                            var ns1="http://xmljs.sf.net/ns1";
                            alert(tag1.getAttributeNS(ns1, "foo"));
                            
                            //now update that attribute with a new value
                            tag1.setAttributeNS(ns1, "ns1:foo", "newFooValue");
                            
                            //the following should be "newFooValue"
                            alert(tag1.getAttributeNS(ns1, "foo"));
                            
                            //add a new attribute in the ns1 namespace
                            tag1.setAttributeNS(ns1, "ns1:newAttribute", "newAttributeValue");
                            
                            //confirm everything went OK.
                            
                            //the following should be "newAttributeValue"
                            alert(tag1.getAttributeNS(ns1, "newAttribute"));
                            
                            //with the attribute added,
                            //the following should be
                            //<ns1:TAG1 ns1:foo="newFooValue" ns1:newAttribute="newAttributeValue">
                            //Hello World
                            //</ns1:TAG1>
                            alert(tag1.getXML());
                            
                        
                        }// end function xmljsDOMExample
                        
                    
 
                    
                    
                    
                    
                        DOMElement - removeAttributeNS method
                    
                    
                        W3C DOM Level 2
                    
                    
                        domElement.removeAttributeNS(<namespaceURI>, <localName>);
                    
                    accepts:
                    
                        String namespaceURI - The namespace to insert the new attribute into
                        String localName - the local name of the attribute to remove
                    
                    
                    returns:
                    
                        N/A
                    
                    
                    throws:
                    
                    
                        The removeAttribute method removes the attribute specified by <localName>
                        and <namespaceURI> from the DOMElement.
                    
                    
                        Example:
                    
                    
                        function xmljsDOMExample() {
                        
                            var xml;
                            xml = ""
                            + "<?xml version=\"1.0\" ?>"
                            + "<ns1:ROOT xmlns:ns1=\"http://xmljs.sf.net/ns1\" >"
                            + "<ns1:TAG1 ns1:foo=\"origValue\">"
                            + "Hello World"
                            + "</ns1:TAG1>"
                            + "</ns1:ROOT>";
                            
                            //instantiate the W3C DOM Parser
                            var parser = new DOMImplementation();
                            
                            //load the XML into the parser and get the DOMDocument
                            var domDoc = parser.loadXML(xml);
                            
                            //get ROOTNODE 
                            var rootNode = domDoc.getDocumentElement();
                            
                            //get the TAG1 node
                            var tag1 = rootNode.getFirstChild();
                            
                            //remove the "ns1:foo" attribute
                            var ns1 = "http://xmljs.sf.net/ns1";
                            tag1.removeAttributeNS(ns1, "foo");
                            
                            //with the attribute removed,
                            //the following should be
                            //<ns1:TAG1>
                            //Hello World
                            //</ns1:TAG1>
                            alert(tag1.getXML());
                            
                        
                        }// end function xmljsDOMExample
                        
                    
 
                    
                    
                    
                    
                        DOMElement - getAttributeNodeNS method
                    
                    
                        W3C DOM Level 2
                    
                    
                        domElement.getAttributeNodeNS(<namespaceURI>, <localName>);
                    
                    accepts:
                    
                        String namespaceURI - The namespace to search in
                        String localName - the attribute name to search for
                    
                    
                    returns:
                    
                        DOMAttr - the attribute corresponding to <localName> in the specified namespace
                    
 
                    
                    throws:
                    
                        N/A
                    
                    
                        The getAttributeNodeNS method will return the DOMAttr object represented by
                        the <localName> and <namespaceURI> passed into the method.
                        If the DOMAttr is not found in the DOMElement, getAttributeNodeNS will return a null.
                    
                    
                        Example:
                    
                    
                        function xmljsDOMExample() {
                        
                            var xml;
                            xml = ""
                            + "<?xml version=\"1.0\" ?>"
                            + "<ns1:ROOT xmlns:ns1=\"http://xmljs.sf.net/ns1\" >"
                            + "<ns1:TAG1 ns1:foo=\"fooValue\">"
                            + "Hello World"
                            + "</ns1:TAG1>"
                            + "</ns1:ROOT>";
                            
                            //instantiate the W3C DOM Parser
                            var parser = new DOMImplementation();
                            
                            //load the XML into the parser and get the DOMDocument
                            var domDoc = parser.loadXML(xml);
                            
                            //get ROOTNODE
                            var rootNode = domDoc.getDocumentElement();
                            
                            //get the TAG1 node
                            var tag1 = rootNode.getFirstChild();
                            
                            //get the attribute value in the
                            //http://xmljs.sf.net/ns1 namespace with the
                            //local name of "foo"
                            var ns1 = "http://xmljs.sf.net/ns1";
                            var domAttrNS = tag1.getAttributeNodeNS(ns1, "foo");
                            
                            //the following should be "fooValue"
                            alert(domAttrNS.getValue());
                            
                            //search for an attribute that does not exist
                            var notThere = tag1.getAttributeNodeNS(ns1, "notThere");
                            
                            //the following should be "true"
                            alert(notThere == null);
                            
                        
                        }// end function xmljsDOMExample
                        
                    
 
                    
                    
                    
                    
                        DOMElement - setAttributeNodeNS method
                    
                    
                        W3C DOM Level 2
                    
                    
                        domElement.setAttributeNodeNS(<newAttribute>);
                    
                    accepts:
                    
                        DOMAttr newAttribute - the DOMAttr object to be added to the element
                    
 
                    
                    returns:
                    
                        DOMAttr - the replaced DOMAttr object or null if the DOMAttr was successfully added to the DOMElement
                    
 
                    
                    throws:
                    
                    
                        The setAttributeNodeNS method adds or updates an attribute in a DOMElement.
                        If a DOMAttr exists within the DOMElement with the same name and namespace as the
                        DOMAttr object passed in, that DOMAttr object is replaced with the new DOMAttr.
                        Otherwise, the new DOMAttr object is simply added to the DOMElement.
                    
                    
                        If the new DOMAttr object replaces a DOMAttr object in the DOMElement, the replaced
                        DOMAttr object is returned. Otherwise, setAttributeNodeNS returns null.
                    
                    
                        Example:
                    
                    
                        function xmljsDOMExample() {
                        
                            var xml;
                            xml = ""
                            + "<?xml version=\"1.0\" ?>"
                            + "<ns1:ROOT xmlns:ns1=\"http://xmljs.sf.net/ns1\" >"
                            + "<ns1:TAG1>"
                            + "Hello World"
                            + "</ns1:TAG1>"
                            + "</ns1:ROOT>";
                            
                            //instantiate the W3C DOM Parser
                            var parser = new DOMImplementation();
                            
                            //load the XML into the parser and get the DOMDocument
                            var domDoc = parser.loadXML(xml);
                            
                            //get ROOTNODE
                            var rootNode = domDoc.getDocumentElement();
                            
                            //get the TAG1 node
                            var tag1 = rootNode.getFirstChild();
                            
                            //create a new attribute in the ns1 namespace
                            var ns1 = "http://xmljs.sf.net/ns1";
                            var newAttr1 = domDoc.createAttributeNS(ns1, "ns1:newAttr");
                            
                            //set the attribute's value
                            newAttr1.setNodeValue("newAttrValue1");
                            
                            //add it to the DOMElement
                            var retVal = tag1.setAttributeNodeNS(newAttr1);
                            
                            //since the new attribute didn't replace an
                            //existing attribute, the retVal should be null
                            //the following should be "true"
                            alert(retVal == null);
                            
                            //now create another new attribute
                            var newAttr2 = domDoc.createAttributeNS(ns1, "ns1:newAttr");
                            
                            //set the attribute's value
                            newAttr2.setNodeValue("newAttrValue2");
                            
                            //now replace the existing attribute "ns1:newAttr"
                            //with the new attribute we just created
                            
                            retVal = tag1.setAttributeNodeNS(newAttr2);
                            
                            //since we replaced a node, the following should be
                            //true (the replaced node was the first attribute
                            //we created)
                            //the following should be "true"
                            alert(retVal == newAttr1);
                            
                            //the following should be
                            //"<ns1:TAG1 ns1:newAttr="newAttrValue2">
                            //Hello World
                            //</ns1:TAG1>
                            alert(tag1.getXML());
                            
                        
                        }// end function xmljsDOMExample
                        
                    
 
                    
                    
                    
                    
                        DOMElement - hasAttributeNS methood
                    
                    
                        W3C DOM Level 1
                    
                    
                        domElement.hasAttributeNS(<namespaceURI>, <localName>);
                    
                    accepts:
                    
                        String namespaceURI - The namespace to search in
                        String localName - the attribute name to search for
                    
                    
                    returns:
                    
                        boolean - true if the attribute exists, false otherwise
                    
                    
                    throws:
                    
                        N/A
                    
                    
                        The hasAttributeNS method provides a simple way to query a DOMElement to
                        determine if it has an attribute with the name and namespace specified.
                    
                    
                        Example:
                    
                    
                        function xmljsDOMExample() {
                        
                            var xml;
                            xml = ""
                            + "<?xml version=\"1.0\" ?>"
                            + "<ns1:ROOT xmlns:ns1=\"http://xmljs.sf.net/ns1\" >"
                            + "<ns1:TAG1 ns1:foo=\"fooValue\">"
                            + "Hello World"
                            + "</ns1:TAG1>"
                            + "</ns1:ROOT>";
                            
                            //instantiate the W3C DOM Parser
                            var parser = new DOMImplementation();
                            
                            //load the XML into the parser and get the DOMDocument
                            var domDoc = parser.loadXML(xml);
                            
                            //get ROOTNODE
                            var rootNode = domDoc.getDocumentElement();
                            
                            //get the TAG1 node
                            var tag1 = rootNode.getFirstChild();
                            
                            var ns1 = "http://xmljs.sf.net/ns1";
                            
                            //the following should be "true"
                            alert(tag1.hasAttributeNS(ns1, "foo"));
                            
                            //the following should be "false"
                            alert(tag1.hasAttributeNS(ns1, "notThere"));
                            
                            //the following should be "false"
                            alert(tag1.hasAttributeNS("badNamespaceURI", "foo"));
                            
                            //the following should be "false"
                            //(the attribute name should be a localName, not a QName
                            alert(tag1.hasAttributeNS(ns1, "ns1:foo"));
                            
                        
                        }// end function xmljsDOMExample
                        
                    
 
                    
                    
                    
                    
                        DOMElement - getElementsByTagName
                    
                    
                        W3C DOM Level 1
                    
                    
                        NOTE: The W3C specification includes
                        getElementsByTagName only for DOMElements and DOMDocuments. XML for <SCRIPT> implements
                        getElementsByTagName for all DOMNodes.
                    
                    
                        You may find documentation on the getElementsByTagName by viewing the
                        DOMNode getElementsByTagName documentation.
                    
                    
                    
                    
                    
                        DOMElement - getElememtnsByTagNameNS
                    
                    
                        W3C DOM Level 2
                    
                    
                        NOTE: The W3C specification includes
                        getElementsByTagNameNS only for DOMElements and DOMDocuments. XML for <SCRIPT> implements
                        getElementsByTagNameNS for all DOMNodes.
                    
                    
                        You may find documentation on the getElementByTagNameNS by viewing the
                        DOMNode getElementsByTagName documentation.