You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Priya Pinto <it...@rediffmail.com> on 2000/09/20 14:22:48 UTC
XML- deleting xml tags using DOM
Hi,
Could some one help me! I'm working on using an XML file as database and have been successful in creating a file and also in recalling the file and adding new records.
The next stage is to be able to delete a particular record and am currently stuck with this!
If possible could u send me an example?
Here's my xml file:
<?xml version="1.0" ?><?xml:stylesheet type="text/xsl" href="http://evereadi:8080/bookmark/xsl/Add.xsl"?>
<bookmarks Autonumber="2">
<bm id="b1">
<title>Yahoo</title>
<description>A search engine</description>
<urls>http://www.yahoo.com</urls>
<category>General</category>
</bm>
<bm id="b2">
<title>Ebay</title>
<description>Auction site</description>
<urls>http://www.ebay.com</urls>
<category>Auction</category>
</bm>
</bookmarks>
I could also post the code I've been working with if required.
Thanks
Priya
_________________________________________________
Get Your Free Email At, http://www.rediffmail.com
For fabulous shopping deals visit: http://www.rediff.co.in/shopping/index.html
Re: XML- deleting xml tags using DOM
Posted by Joe Sabu <Jo...@dothill.com>.
You could, using DOM, traverse right upto the parent of the Node you want to
delete, and call removeChild(node_to_be_removed)
Gor e.g., if you want to remove the bookmark b1,
Elem e = doc.getElementbyId("b1");
Node parent = (Node)e.getParentNode();
parent.removeChild(e);
Hope it helps. BTW, this is the way it is in XML4J, I think it's the same in
Xerces too.
Joe Sabu
----- Original Message -----
From: "Priya Pinto" <it...@rediffmail.com>
To: <ge...@xml.apache.org>
Sent: Wednesday, September 20, 2000 8:22 AM
Subject: XML- deleting xml tags using DOM
Hi,
Could some one help me! I'm working on using an XML file as database and
have been successful in creating a file and also in recalling the file and
adding new records.
The next stage is to be able to delete a particular record and am currently
stuck with this!
If possible could u send me an example?
Here's my xml file:
<?xml version="1.0" ?><?xml:stylesheet type="text/xsl"
href="http://evereadi:8080/bookmark/xsl/Add.xsl"?>
<bookmarks Autonumber="2">
<bm id="b1">
<title>Yahoo</title>
<description>A search engine</description>
<urls>http://www.yahoo.com</urls>
<category>General</category>
</bm>
<bm id="b2">
<title>Ebay</title>
<description>Auction site</description>
<urls>http://www.ebay.com</urls>
<category>Auction</category>
</bm>
</bookmarks>
I could also post the code I've been working with if required.
Thanks
Priya
_________________________________________________
Get Your Free Email At, http://www.rediffmail.com
For fabulous shopping deals visit:
http://www.rediff.co.in/shopping/index.html
---------------------------------------------------------------------
In case of troubles, e-mail: webmaster@xml.apache.org
To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org