The moose likes XML and Related Technologies and the fly likes Editing an xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Editing an xml" Watch "Editing an xml" New topic

Editing an xml

shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
I have to edit an xml(only specified attributes) based on the output from
the how can i do it...Either by using dom/sax/xpath?
shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
*How to edit the attribute of the element in an existing xml in java*...Anyone help me,please...
[ March 11, 2008: Message edited by: shalini gnana ]
Anuradha Karunamuni
Ranch Hand

Joined: Dec 08, 2007
Posts: 64
I have done this using DOM, but I am not an expert on this subject. Anyway I'll try to help you. Can you please tell what exactly needs to be done in detail.

"Simplicity is the ultimate sophistication..." ~Leonardo da Vinci~
SCJP 1.4
amulya gudapati

Joined: Feb 27, 2008
Posts: 5
This can be done using DOM or SAX parsing
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
SAX is just for parsing XML - you can't use it to change XML (unless you want to write code that recreates the complete XML file).

DOM can be used, as could any of the other XML object models (XOM, JDOM, dom4j). See e534 to e538 for examples of how to work with attributes in DOM. See this for how to obtain a DOM Document from an XML file in the first place.
I agree. Here's the link:
subject: Editing an xml
It's not a secret anymore!