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

Retrieving Nodes Based on Run-time Attribute Values ???

Status
Not open for further replies.

thuraivan

Technical User
Dec 11, 2001
8
IN
I have the following xml table :

<QuestionBank>
<Question Number=&quot;1&quot;>
<TextOfQuestion> Text of Question </TextOfQuestion>
<Answer> Text of Answer to Question 1 </Answer>
</Question>

<Question Number=&quot;2&quot;>
<TextOfQuestion> Text of Question </TextOfQuestion>
<Answer> Text of Answer to Question </Answer>
</Question>
</QuestionBank>

(Actually, i have truncated the file)...

(Number Attribute above is not of ID type)

Supposing, if i have the value of the &quot;Number&quot; Attribute of Question Node from the user &quot;AT RUN-TIME&quot;... how to retrieve the Text of both the TextOfQuestion Node and Answer Node pertaining to the &quot;Number&quot; Attribute...

Note : I have got the desired result using MSXML-DOM... Actually, i am looking for a more efficient solution...
 
Hello Thuraivan,

I am beginning to study XML and saw this posted in the ASP forum. Your question gave me a good reason to dig into the book, install MSXML, and spend a hour reading about writing XPATH addresses.

Your parting note intriques me. What did you find inefficient using MSXML-DOM, performance, code complexity?
And what do you entertain as an alternative, writing javascript to parse the XML, a different XML interface?

Richard
 
Hello Richard,

Welcome to the world of XML... I guess... we are in the same world... Am a beginner too...

To answer your question, when i posted that question, i only had one concrete solution with me.. that is to parse node by node, check for ID attribute and if the appropriate Node Attribute is found... then do whatever is to be done with that specific node and it's child nodes...

After i posted that question, I went thru' some books etc.. and now have one more attractive solution... &quot;BY PASSING THE PARAMETER&quot; (SEARCH CRITERION, which is accepted from the user), into XSL...

If u want to have a glimpse of it, and if u haven't already cracked it, just notify me and i shall post the code here...

Thiagu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top