Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2007

Tip: Looking for answers? Try searching our database.

Reading editing deleting in DOM

Thread view: 
Buddha - 06 Aug 2007 16:54 GMT
Dear all,

I did some search and found this to be the most responsive group.
Could somebody please show me using code how I could delete a child
node (off a specific parent node) from XML using DOM ?

Thanks in advance for your time.

Regards,
Thomas Fritsch - 06 Aug 2007 18:36 GMT
> I did some search and found this to be the most responsive group.
> Could somebody please show me using code how I could delete a child
> node (off a specific parent node) from XML using DOM ?
See <http://java.sun.com/j2se/1.5.0/docs/api/org/w3c/dom/Node.html>.
There is a removeChild(Node) method.

Signature

Thomas

Greg R. Broderick - 06 Aug 2007 19:49 GMT
Buddha <happybuddha1@gmail.com> wrote in news:1186415699.933494.81690
@i38g2000prf.googlegroups.com:

> Could somebody please show me using code how I could delete a child
> node (off a specific parent node) from XML using DOM ?

You would use the method org.omg.dom.Node.removeChild(Node oldChild)  on
the parent node of the node which you wish to delete, passing a reference
to the node that you wish to delete as the 'oldChild' parameter, so:

Node parent = node.getParentNode();

if (parent != null)
{
   parent.removeChild(node);
}

Cheers!
GRB

Signature

---------------------------------------------------------------------
Greg R. Broderick                  usenet200705@blackholio.dyndns.org

A. Top posters.
Q. What is the most annoying thing on Usenet?
---------------------------------------------------------------------

Buddha - 08 Aug 2007 03:59 GMT
thanks Thomas and Greg for your replies.
I will post back with whatever code I figured out.

thanks again.

Regards,


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.