Java with xml

G

glin

Hi guys, I am wondering which library to use to manipulate xml files in
Java.

Cheers.
 
D

Dag Sunde

Hi guys, I am wondering which library to use to manipulate xml files in
Java.

GNU JAXP - The GNU Project
Lark - Tim Bray
Piccolo - Yuval Oren
Xerces Java - The Apache XML Project
XP - James Clark (Java 1.1)
XML Pull Parser - Aleksander SlominskiJava and C++
JDOM
Crimson
Ælfred
....

take your pick...

(At least I've given you some food for Google...)
(Prefer Xerces myself)
 
W

Wendy S

Hi guys, I am wondering which library to use to manipulate xml files in
Java.

What do you want to do with the XML?

I'm having a lot of fun with [Jakarta Commons] Digester. It's a layer on
top of a SAX parser, originally written to parse config files and create
objects as it goes along. The possibilities are endless...
 
F

Fahd Shariff

There are three main XML parsing techniques:

- Document Object Model (DOM),
- Simple API for XML (SAX),
- Streaming API for XML (StAX) - NEW

DOM:

Tree-based parsing technique that builds up an entire parse tree in
memory.
- DOM is straightforward.
- You can access the XML document randomly because the entire tree is
built in memory.
- The DOM APIs allow modification of the nodes, such as appending a
child or updating or deleting a node.

Loading the whole document and building the entire tree structure in
memory can be expensive, especially when the document is large. It can
also consume a lot of memory.

DOM parsing is appropriate when the application needs to have random
access to the XML document. Because DOM enables you to update the
document, it is also convenient for applications, such as XML editors,
that need to modify data.

SAX:

Rather than building a tree representation of an entire document as DOM
does, a SAX parser fires off a series of events as it reads through the
document. These events are pushed to event handlers, which provide
access to the contents of the document.

The SAX model has the major advantage of low memory consumption,
because the entire document does not need to be loaded into memory at
one time, which enables a SAX parser to parse a document larger than
the system memory. The disadvantages are:
- need to implement the event handlers to handle all incoming events
- it does not have built-in document navigation support such as that
provided by XPath. This, coupled with its one-pass parsing, means there
is no random access support.
- poor choice for manipulating or modifying a document
 
I

Intel Inside

Wendy S said:
Hi guys, I am wondering which library to use to manipulate xml files in
Java.

What do you want to do with the XML?

I'm having a lot of fun with [Jakarta Commons] Digester. It's a layer on
top of a SAX parser, originally written to parse config files and create
objects as it goes along. The possibilities are endless...

Possibilities?
 
E

Edmond wong

Intel said:
Hi guys, I am wondering which library to use to manipulate xml files in
Java.

What do you want to do with the XML?

I'm having a lot of fun with [Jakarta Commons] Digester. It's a layer on
top of a SAX parser, originally written to parse config files and create
objects as it goes along. The possibilities are endless...


Possibilities?

Digester only read xml file into java objects, there is a common.betwixt
build on top of digester to do java objects to xml. But the 0.6
has some problem, you will need to download the nightly build. Yet,
there is another problem if you have a root class with only one
parameter, and the parameter is a class. You can try castor or jaxb ,
those may be more stable.

Edmond
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top