Hi,
I am trying to read xml data using asp! I have this xml code:
<?xml version="1.0" ?>
<persons>
<person>
<fname> joe </fname>
<sname> smith </sname>
<roomno> E127 </roomno>
<processor> Pentium 4 </processor>
<memory> 512 mb ram </memory>
<hardisk> 40 gb hard disk space </hardisk>
<cd_writer> CD Writer 8-4-32 </cd_writer>
<printer> Bubble Jet 450C </printer>
<description> The computer was purchased in 1999 and is due for an upgrade in 2004 </description>
</person>
I can read it fine with:
strfname = objXML.documentElement.firstChild.firstChild.text
strsname = objXML.documentElement.firstChild.childNodes(1).text
strroomno = objXML.documentElement.firstChild.childNodes(2).text
strprocessor = objXML.documentElement.firstChild.childNodes(3).text
strmemory = objXML.documentElement.firstChild.childNodes(4).text
strhardisk = objXML.documentElement.firstChild.childNodes(5).text
strcd_writer = objXML.documentElement.firstChild.childNodes(6).text
strprinter = objXML.documentElement.firstChild.childNodes(7).text
strdescription = objXML.documentElement.firstChild.childNodes(8).text
THE PROBLEM IS: What number child node would be the next bit????
<person>
<fname> Ian </fname>
<sname> Wright </sname>
<roomno> E130 </roomno>
<processor> Pentium 4 </processor>
<memory> 512 mb ram </memory>
<hardisk> 40 gb hard disk space </hardisk>
<cd_writer> CD Writer 8-4-32 </cd_writer>
<printer> Bubble Jet 450C </printer>
<description> The computer was purchased in 1999 and is due for
an upgrade in 2004 </description>
</person>
Would I start from 9, following on from the previous or would I start from 0....??
Please advise me.
Thanks
Riks
I am trying to read xml data using asp! I have this xml code:
<?xml version="1.0" ?>
<persons>
<person>
<fname> joe </fname>
<sname> smith </sname>
<roomno> E127 </roomno>
<processor> Pentium 4 </processor>
<memory> 512 mb ram </memory>
<hardisk> 40 gb hard disk space </hardisk>
<cd_writer> CD Writer 8-4-32 </cd_writer>
<printer> Bubble Jet 450C </printer>
<description> The computer was purchased in 1999 and is due for an upgrade in 2004 </description>
</person>
I can read it fine with:
strfname = objXML.documentElement.firstChild.firstChild.text
strsname = objXML.documentElement.firstChild.childNodes(1).text
strroomno = objXML.documentElement.firstChild.childNodes(2).text
strprocessor = objXML.documentElement.firstChild.childNodes(3).text
strmemory = objXML.documentElement.firstChild.childNodes(4).text
strhardisk = objXML.documentElement.firstChild.childNodes(5).text
strcd_writer = objXML.documentElement.firstChild.childNodes(6).text
strprinter = objXML.documentElement.firstChild.childNodes(7).text
strdescription = objXML.documentElement.firstChild.childNodes(8).text
THE PROBLEM IS: What number child node would be the next bit????
<person>
<fname> Ian </fname>
<sname> Wright </sname>
<roomno> E130 </roomno>
<processor> Pentium 4 </processor>
<memory> 512 mb ram </memory>
<hardisk> 40 gb hard disk space </hardisk>
<cd_writer> CD Writer 8-4-32 </cd_writer>
<printer> Bubble Jet 450C </printer>
<description> The computer was purchased in 1999 and is due for
an upgrade in 2004 </description>
</person>
Would I start from 9, following on from the previous or would I start from 0....??
Please advise me.
Thanks
Riks