You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Harinee Sampath <ha...@hotmail.com> on 2000/08/07 17:12:34 UTC

Remove Child

Hi all,

How do I remove an element with a particular attribute value from a document 
created by parsing an XML file?I am using xerces 1.1.1.I am also kind of new 
to Java,which might be the problem.If I use removeChild() of Node,it removes 
all the elements of that name.

Any help is appreciated.Thanks.

Harinee
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


Re: Remove Child

Posted by Arnaud Le Hors <le...@us.ibm.com>.
The DOM really support any query mechanism. All it can do is search for
a specific element with its ID or name. If you have the element name you
can search for it with getElementsByTagname() or
getElementsByTagnameNS(). Then you're on your own to look for the one
that has the attribute you want.
Once you have the relevant element node, to remove it you can do
something like:

el.getParentNode().removeChild(el);
-- 
Arnaud  Le Hors - IBM Cupertino, XML Technology Group

Re: Remove Child

Posted by Eric Ye <er...@locus.apache.org>.
Can you post the code snippet used to remove the element node? To my
knowledge, removeChild(Node oldchild) should just remove that particular
'oldchild'.
_____


Eric Ye * IBM, JTC - Silicon Valley * ericye@locus.apache.org

----- Original Message -----
From: "Harinee Sampath" <ha...@hotmail.com>
To: <xe...@xml.apache.org>
Sent: Monday, August 07, 2000 8:12 AM
Subject: Remove Child


> Hi all,
>
> How do I remove an element with a particular attribute value from a
document
> created by parsing an XML file?I am using xerces 1.1.1.I am also kind of
new
> to Java,which might be the problem.If I use removeChild() of Node,it
removes
> all the elements of that name.
>
> Any help is appreciated.Thanks.
>
> Harinee
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
>
>