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:  NamedNodeMap::getNamedItem

NamedNodeMap.getNamedItem(name)

The getNamedItem method returns a Node object for the specified item, or null if the item does not exist.

The following example loads the 'states.xml' file and uses the getNamedItem method to create a Node object of the 'ref' attribute of the last 'State' element. It then displays its nodeValue.

XML:
<States>
   <State ref="FL" const="27">
      <name>Florida</name>
      <capital>Tallahassee</capital>
   </State>
   <State ref="IA" const="29">
      <name>Iowa</name>
      <capital>Des Moines</capital>
   </State>
</States>

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

Set objLastChild = objXMLDoc.documentElement.lastChild
Set objAttributes = objLastChild.attributes
Set objRefAttr = objAttributes.getNamedItem("ref")
document.write(objRefAttr.nodeValue)

Output:
IA



 


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