Was
Was

Reputation: 23

How to handle XML in Java with a simple access to the nodes?

What best meets my requirements in creating and modifying XML?

Requirements:

What can be recommend?

Upvotes: 1

Views: 161

Answers (3)

Yaneeve
Yaneeve

Reputation: 4779

Perhaps this is overkill for you but XmlBeans from Apache is pretty cool and JAXB with Binders (which is perhaps a bit more modern) are both great options for modelling strictly defined XML (those with XSD Schema, DTD) in a Java friendly manner as simple beans. With a little extra coding, both can use XPath to reference elements within the XML data.

Upvotes: 0

matsev
matsev

Reputation: 33749

If you can use Groovy, XmlSlurper plays nicely with Java, e.g. reading and updating. Groovy has its own expression language GPath, which has similar purpose as the more well-known XPath.

Curious for more? Visit Groovy XML processing.

Upvotes: 0

Raihan
Raihan

Reputation: 10395

You can use Java XPath API in javax.xml.xpath package. This is a tutorial

And to create XML nodes using XPath check this out

Upvotes: 2

Related Questions