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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie, help with sorting output 1

Status
Not open for further replies.

logx

Technical User
Jul 24, 2006
14
RS
Hi guys,

I have a bit of a problem and I can't seem to fix it. My XML file looks like this:

<?xml version="1.0"?>

<method>
<par>
<joint>
<name>SetupK</name>
<value>Start</value>
</joint>
</par>
</method>

I want to be able to assign the "Start" in <value></value> to a variable in my ASP code, but I'm unable to figure out how. If I use firstchild, I will get both SetupK and Start, which is not something I want. I want to try and avoid using XSL in this case, if possible.

Thanks a bunch for helping!
 
>If I use firstchild, I will get both SetupK and Start, which is not something I want.
If it is not firstchild, what hold you back from trying second or third (depending on the whitespace setting) child?
 
Perhaps my lack of knowledge.

When I use:

heading = xml.documentElement.childNodes(0).text
response.write (heading)

I get "SetupK Start", and if I use:

heading = xml.documentElement.childNodes(1).text
response.write (heading)

Microsoft VBScript runtime error '800a01a8'

Object required: 'documentElement.childNodes(...)'

I need to get the <value>Start</value> displayed by all means, alone.

Thanks.
 
[tt]heading=xml.documentElement.selectSingleNode("/method/par/joint/value").text
'or
heading2=xml.documentElement.selectSingleNode("/method/par/joint/value").firstchild.nodeValue
'or
heading3=xml.documentElement.childNodes(0).childNodes(0).childNodes(1).text
[/tt]
 
Some things seem so complicated, yet...

Thank you!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top