File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Conversion to 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 "Conversion to XML" Watch "Conversion to XML" New topic

Conversion to XML

vivek dhiman
Ranch Hand

Joined: Aug 05, 2011
Posts: 151


I have the XML file I want to transform this XML to below format.

Any Help using DOM4j.
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 632
The core functionality sought after through the xslt is achieved via the template like this.

The translate() is just a minimum attempt to guard against invalid tag name because in principle nothing guarantees the attribute Name contains a valid string acceptable to be a tag name, nothing except you have a validating parser and a schema to validate the xml instance against it. It collapses the space and it is only one way amongst others. The instance you show has no problem to do without it but again there is no guarantee in general some other instances are as good. If you're sure there is none that poses problem in that regard, you can do without it.

dom4j supports xslt and it works just like any other processing library which supports xslt. That part is kind of routine as long as you know xslt; if not, you've some readings to do before taking on the issue xslt-way.
I agree. Here's the link:
subject: Conversion to XML
jQuery in Action, 3rd edition