Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting values out of XML with ASP

Status
Not open for further replies.

firsttube

Technical User
Apr 21, 2004
165
CA
I have an xml stream coming back to an asp page that loos like this:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<data>
	<item>
		<cell name="NAME" value="John" />
	</item>
	<item>
		<cell name="NAME" value="DAve" />
	</item>
	<item>
		<cell name="NAME" value="Tom" />
	</item>
</data>

I want to get these names into variables in asp and do something with them. So far I have this:
Code:
set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
	set nodeList = Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.loadXML (xml) 
	
	Set nodeList = xmlDoc.getElementsByTagName("item")
For i = 0 To nodeList.length - 1
		Set n = nodeList.Item(i)	
response.write([WRITE THE VALUES HERE])
Next


But this is just not doing anything. Any help here?

thanks



Information is not Knowledge, Knowledge is not Wisdom, Wisdom is not Truth, Truth is not Beauty, Beauty is not Love, Love is not Music, Music is the best.
 
try this:

Code:
set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
    set nodeList = Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.loadXML (xml)

Set Root = xmlDoc.documentElement 

Set nodeList = Root.getElementsByTagName("item") 

For Each Elem In nodeList 
   response.write(Elem.firstChild.nodeValue "<br>") 
Next

hth

simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top