METHOD:  Element::getAttributeNode


The getAttributeNode method returns an Attr object of the specified name, as opposed to just the string value returned by the getAttribute method. If the named attribute connot be found on this element, this method returns null.

The following example uses the 'states.xml' file and gets an Attr object of 'ref' attribute of the last 'State' element. The code then displays its name and value.

   <State ref="FL" const="27">
   <State ref="IA" const="29">
      <capital>Des Moines</capital>

Code (VBScript):
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False

Set LastState = objXMLDoc.documentElement.lastChild
Set RefAttr = LastState.getAttributeNode("ref")
document.write("Name: " &
document.write("<br>Value: " & RefAttr.value)

Name: ref
Value: IA

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