Click to See Complete Forum and Search --> : XML Doubt pls help...


saju_m
02-11-2003, 10:39 PM
i got 2 doubts pls help..

a sample XML
------------

<STUDENT>
<RECORD ID="1">
<FIELD NAME="id">001</FIELD>
<FIELD NAME="name">MR.X</FIELD>
</RECORD>
<RECORD ID="2">
<FIELD NAME="id">002</FIELD>
<FIELD NAME="name">MR.Y</FIELD>
</RECORD>

</STUDENT>

1. i'll ve a function filterNode() to which i'll pass the query
condition ie.
for eg. filterNode("id=002")
now it s supposed to return the whole node itself which contains
the id = 002 (as a node)

ie for eg.

<RECORD ID="2">
<FIELD NAME="id">002</FIELD>
<FIELD NAME="name">MR.Y</FIELD>
</RECORD>


2. How to convert a node to xml

the above filterNode() returns node object (as said above) and i'm
supposed to convert that node back to readable xml file for furthur
searching purposes.


please help in solving these two..


thank you


Regards,

Saju.M

khalidali63
02-12-2003, 09:11 AM
htere could be multiple ways yu can pick.
Presuming you are using JavaScript DOM model to parse the XML.
First i think node object should be readable using node.toString() method.
second.
NodeList nl = node.childNodes
it will return an array of childnodes

nl[n] should give you a node

hope this helps

Khalid