L
lejason
I am having trouble with a really simple problem! haha. How do you
display that data from on xml file. Here is my xml file called
"test.xml"
<?xml version="1.0" encoding="iso-8859-1"?>
<test>
<person>
<name>Jason</name>
<color>blue</color>
<number>16</number>
</person>
<person>
<name>Josh</name>
<color>red</color>
<number>10</number>
</person>
<person>
<name>Justin</name>
<color>blue</color>
<number>7</number>
</person>
</test>
Now, what I want to do is to have it display all the elements per
<person>. For example, I want an output to say be something to the
extent of....
Jason
blue
16
Josh
red
10
Justin
blue
7
So here is the ASP I have set up...but it doesnt work. I am having
problems with the syntax I think?
' Sets up the DOM
Dim xdoc
Set xdoc=Server.CreateObject("Microsoft.XMLDOM")
xdoc.async=false
xdoc.load("c:\test.xml")
if xdoc.parseError.errorcode<>0 then
response.write("there was obviously an error")
else
response.write("Things worked <br><br>")
end if
Set Root = xdoc.documentElement
Set NodeList = Root.getElementsByTagName("person")
For Each Elem In NodeList
response.write(Elem.firstChild.firstchild.nodeValue)
Next
============================
that code wont error, but it only shows the firstchild. So I tired
Elem.firstChild.childNodes(1).nodeValue right after it and it broke
"Object requried".
WTf?
help?
%>
display that data from on xml file. Here is my xml file called
"test.xml"
<?xml version="1.0" encoding="iso-8859-1"?>
<test>
<person>
<name>Jason</name>
<color>blue</color>
<number>16</number>
</person>
<person>
<name>Josh</name>
<color>red</color>
<number>10</number>
</person>
<person>
<name>Justin</name>
<color>blue</color>
<number>7</number>
</person>
</test>
Now, what I want to do is to have it display all the elements per
<person>. For example, I want an output to say be something to the
extent of....
Jason
blue
16
Josh
red
10
Justin
blue
7
So here is the ASP I have set up...but it doesnt work. I am having
problems with the syntax I think?
' Sets up the DOM
Dim xdoc
Set xdoc=Server.CreateObject("Microsoft.XMLDOM")
xdoc.async=false
xdoc.load("c:\test.xml")
if xdoc.parseError.errorcode<>0 then
response.write("there was obviously an error")
else
response.write("Things worked <br><br>")
end if
Set Root = xdoc.documentElement
Set NodeList = Root.getElementsByTagName("person")
For Each Elem In NodeList
response.write(Elem.firstChild.firstchild.nodeValue)
Next
============================
that code wont error, but it only shows the firstchild. So I tired
Elem.firstChild.childNodes(1).nodeValue right after it and it broke
"Object requried".
WTf?
help?
%>