Thomas
Thomas

Reputation: 1312

Perform xml transformation and filtering in java

I'd like to filter a couple of nested xml elements, evaluation of their attributes. For this purposes I'm searching a efficient and lightweight java api or framework.

The main requirements are:

My first idea was apache jelly, but jelly has an ungly side effect. It removes CDATA tags and thats an unwanted behaviour.

Thanks in advance.

Upvotes: 0

Views: 254

Answers (5)

Brad Cox
Brad Cox

Reputation: 384

I use and recommend xquery over xslt. Both are functional languages and take some getting used to. Saxon supports both. See http://saxon.sourceforge.net/

Upvotes: 0

Clinton
Clinton

Reputation: 2837

Would XSLT work for you? There are java libraries built in for this, and the layout is such that you can setup sections only when certain tags and/or conditions are met. Then again, you have to learn XSLT.

Upvotes: 0

Thomas
Thomas

Reputation: 1312

Finally I implemented the filterchain using dom4j and xpath. I decided for this api because it is quite handy if you got to move a number of branches inside one document and it's build in xpath facilitates finding the wanted elements.

Thanks for your answers.

Upvotes: 0

Charlie Martin
Charlie Martin

Reputation: 112346

Go simple and try SAX.

Upvotes: 1

willcodejavaforfood
willcodejavaforfood

Reputation: 44053

I am pretty sure JXPath has filtering capabilities. Worth having a look at probably :)

Upvotes: 0

Related Questions