jQuery in Action, 2nd edition*
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Conversion to XML" Watch "Conversion to XML" New topic
Author

Conversion to XML

vivek dhiman
Ranch Hand

Joined: Aug 05, 2011
Posts: 116

Hi

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: 511
    
    3
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.
 
Don't get me started about those stupid light bulbs.
 
subject: Conversion to XML