Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











METHOD:  Element::removeAttributeNode

Element.removeAttributeNode(name)

The removeAttributeNode method removes the specified attribute from the element, returning the removed Attr object. If the removed attribute has a default value, it is immediately replaced by it.

In the following example using the 'albums.xml' file the 'category' attribute is removed from the last 'Album' element. The code then displays the names of the remaining attributes.

XML:
<Albums>
   <Album ref="CD142" category="Folk">
      <title>Boil The Breakfast Early</title>
      <artist>The Chieftains</artist>
   </Album>
   <Album ref="CD720" category="Pop">
      <title>Come On Over</title>
      <artist>Shania Twain</artist>
   </Album>
   <Album ref="CD024" category="Country">
      <title>Red Dirt Girl</title>
      <artist>Emmylou Harris</artist>
   </Album>
</Albums>

Code (JavaScript):
xml_doc = new ActiveXObject("Microsoft.XMLDOM");
xml_doc.async = false;
xml_doc.load("albums.xml");

elem = xml_doc.documentElement.lastChild;
attr = elem.getAttributeNode("category");
attr = elem.removeAttributeNode(attr);
atts = elem.attributes;
n_atts = atts.length;
for (i = 0; i < n_atts; i++)
   document.write(atts[i].name + "<br>");

Output:
ref



 


Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information