March 4th, 2003, 06:02 AM
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 version="1.0" encoding="ISO-8859-1"?>
<State ref="FL" const="27">
<State ref="IA" const="29">
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.
set XMLDoc = Server.CreateObject("Microsoft.XMLDOM")
XMLDoc.async = false
set states = XMLDoc.getElementsByTagName("State")
n_states = states.length
for i = 0 to n_states-1
Set state = states.item(i)
"They have the internet on computers now" - Homer
March 8th, 2003, 11:23 PM
If your code is exactly as you've written, the problem may be because XML is case-sensitive. Your <state> tag should be all in lower case instead of <State>. XML generally ignores tags it doesn't recognize, so that may be why you're not getting an error message. Hope this helps.
Comments on this post