• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

adding and removing elements from DOM in java

 
Brandon Broschinsky
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have written a program that store address book information in a XML file. I can read the data into a dom tree and navigate up and down the tree when a user presses a button to display the next entry. I want to be able to add and delete elements. I am having trouble getting this. the structure of my XML is as follows:

<?xml version="1.0" encoding="iso-8859-1"?>
<Address_Book>
<entry>
<fName>first name</fName>
<lName>last name</lName>
<address1>first part</address1>
<address2>first part</address2>
<city>city</city>
<state>state</state>
<zip>zip</zip>
<phone>phone</phone>
<cell>cellphone</cell>
<email>email address</email>
<notes>this is important</notes>
</entry>
</Address_Book>

Only I have multiple entry elements with listed children. I would like to be ableo to remove an entry section with all children and add one as well with the children. Any help is appreciated.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you seen JavaAlmanac.com?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless I totally misunderstand your problem, all the methods you want are in org.w3c.org.Node Interface.
Bill
 
Brandon Broschinsky
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to all the replies I got it figured out. I was running into issues about where to add the new nodes.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic