You can access them directly with XPath or the GetNamedItem method
called on the node.

For example (using XPath):

<cfscript>
iBookID = xmlDoc.selectSingleNode("//book/@id");
</cfscript>


Brett Suwyn
mailto:[EMAIL PROTECTED]
http://forums.siteobjects.com

|>   -----Original Message-----
|>   From: Carl [mailto:[EMAIL PROTECTED]] 
|>   Sent: Monday, July 09, 2001 3:08 PM
|>   To: CF-Talk
|>   Subject: MSXML, XML, outputting attributes?
|>   
|>   
|>   Hi,
|>   How do I output attributes from an XML document? I have 
|>   tried using the following example on Microsofts website.
|>   
|>   MS EXAMPLE:
|>   var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
|>   var nodeBook, sIdValue;
|>   xmlDoc.async = false;
|>   xmlDoc.load("books.xml");
|>   nodeBook = xmlDoc.selectSingleNode("//book");
|>   sIdValue = nodeBook.getAttribute("id")
|>   alert(sIdValue);
|>   
|>   Thanks!!
|>   Carl
|>   


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to