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











PROPERTY:  Object::attributes

Object  Attr   CDATASection   CharacterData   Comment   Document   DocumentFragment   DocumentType   Entity   EntityReference   Node   Notation   ProcessingInstruction   Text
 
Object.attributes
 
The attributes property contains a list of attributes for any node that can have them. It returns a NamedNodeMap object for Element, Entity and Notation nodes, and null for any other type. The NamedNodeMap can then be accessed to obtain values for those attributes. If a valid nodeType does not have any attributes, then the length of the list is set to zero. The example that follows loads an XML page for CD's. The first child node of the root is a 'CD' tag, and these tags have one attribute: a 'ref' attribute whose value is a reference number for the CD.

<CD ref="CCD142">

Having loaded the XML file, the following code then assigns the attributes of this child node to an NamedNodeMap object, and iterates through them displaying them on the page.

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

Dim objNamedNodeMap, intAtt, strAttName
Set objNamedNodeMap = objXMLDoc.documentElement.firstChild.attributes
For Each intAtt in objNamedNodeMap
   document.write(intAtt.name & "<br>")
Next

Output:
ref



 


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