
March 4th, 2003, 06:02 AM
|
|
php newbie
|
|
Join Date: Nov 2001
Posts: 512
  
Time spent in forums: 3 Days 5 h 15 m 59 sec
Reputation Power: 11
|
|
|
XML getattributes
Hi, i have this simple script i got from the net that is used to parse XML with ASP. It uses the "getattributes" function to get information from xml tags....
xml
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<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>
asp..
Code:
<%
set XMLDoc = Server.CreateObject("Microsoft.XMLDOM")
XMLDoc.async = false
XMLDoc.load("test.xml")
set states = XMLDoc.getElementsByTagName("State")
n_states = states.length
for i = 0 to n_states-1
Set state = states.item(i)
response.write state.getAttribute("ref")
response.write "<br>"
next
%>
Nothing is printed out in the ASP page even though according to the script i should get "FL IA" printed out. The problem seems to be that its not finding any tages called 'State'. If you print out "response.write n_states", the result is zero. Does anyone know where its going wrong? Thanks.
__________________
"They have the internet on computers now" - Homer
|