This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 111

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: 499
    
    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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Conversion to XML
 
Similar Threads
java.util.ArrayList is not compatible with class java.lang.String exception (SOLVED)
saving the details in when i click next and previous buttons
Migrating from Spring 2.0 and Hibernate 3.0 to Spring 3.1 and Hibernate 4.1
JavaPOS EPSON printer
Passing data to and from a jsp page