Click to See Complete Forum and Search --> : XML traversing doubt


saju_m
03-24-2003, 02:33 AM
Hi,

I got a doubt in Node traversing

i ve to remove certain child nodes from a given node

for example:

<RECORD>
<FIELD NAME="EMPNO">001</FIELD>
<FIELD NAME="EMPNAME">Mr.XYZ</FIELD>
<FIELD NAME="SALARY">10000</FIELD>
</RECORD>

i parsed the above given xml and have a node object from it.

now the problem is


i've to remove the the <FIELD> where the Attribute Name="EMPNO" in the runtime.

please tell me how to do so?

is it possible to use removeChild()...

if so how?

please help

thanking you

saju.m

khalidali63
03-24-2003, 08:33 AM
supose you have XML document for the above mentioned node(record)

Node parent

Here is how the logical flow will work.
loop through all the elements
for each element
ele = nodeList[x]
loop through the attributes
if(element.getAttribute("name")
is equal to "empno"
parent.removeChild(ele);


I hope this makes sense for you..

Cheers

Khalid