wood burning stoves*
The moose likes XML and Related Technologies and the fly likes Java API's for editing XML document 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 "Java API Watch "Java API New topic
Author

Java API's for editing XML document

Abhijeet Deshmukh
Greenhorn

Joined: Aug 09, 2004
Posts: 6
Hi all,


I want to edit a XML document from a java application which api's should i use for this. As going through docs i found

javax.xml.parser : Provides common interface fro diff sax & DOM parser.

but can we edit xml file through these api's.
kindly send me reply as soon as possible


Thanks & Regards,
Abhijeet
JuanP barbancho
Ranch Hand

Joined: Oct 25, 2005
Posts: 52
Hi,

I think that the fastest for performance is SAXParser, but you need create the complete tree and object.

I think that JDOM is good for java programmer. I unkown if this api is supported.
David Patterson
Ranch Hand

Joined: Jul 01, 2002
Posts: 65
If you use JDOM, you will wind up with a Document object. You can either use a SAXParser (usually this is the best way to go if your input is an XML file) or a DOMParser (if you already have the DOM Object).

With a Document, you can easily edit:
- change the text string in an element
- add new elements or attributes
- delete elements or attributes
- change the contents of an attribute

Dave Patterson
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12681
    
    5
There is no need to use JDOM - still a non-standard API. The standard toolkit in the Java SDK since version 1.4 gives you all you need to change, add or remove Elements, Nodes and attributes in a org.w3c.dom.Document object.
Bill


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java API's for editing XML document
 
Similar Threads
How to Make Changes to an XML File and save them
Simple XML
Drag and Drop Java Portlet functionality
JATO Vs JDOM
Java Miscrosoft Word API