Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to delete a perticular node from xml file using java code

843834Jul 21 2006 — edited Jul 21 2006
Hii All,
Now i am trying to delete a perticular node from xml file.Like...
XML file:
---------------------
<Licence>
<SERVER>
<was id="1">1</was>
<was id="2">2</was>
</SERVER>
</LICENCE>
-----------------------------
I am working in messaging service using JABBER framework with whiteboard facility.
Here Some commands i have created to add,modify,delete nodes from xml file.They Are

----
1.If u want to add a new node then.
create Licence.SERVER <ss id="3">ddd</ss> lic.xml
(here u want to add a new node called "ss" under Licence.SERVER.
And lic.xml is tyhe xml file name where it was saved.
-----
2.If u want to delete a node(Suppose <was id="1">),then the command should be
---
delete Licence.SERVER.was:id='"1" lic.xml
-----
A problem arises that here it find two was attributes.And it delete the last was attribute,not the requested node.
-------------------

PLEASE HELP ME IN SOLVING THIS CODE..
------------------------------------
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 18 2006
Added on Jul 21 2006
1 comment
137 views