File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes XML Generation with Freemarker Templates. 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 "XML Generation with Freemarker Templates." Watch "XML Generation with Freemarker Templates." New topic
Author

XML Generation with Freemarker Templates.

Rakesh Jhamb
Ranch Hand

Joined: Jun 18, 2003
Posts: 154
I have a predefined XML schema (XSD file). I need to generate a XML according to that XSD and populate the tag values from Java Objects...
Right now, there is a built solution that is able to create XML, but the problem is that inside the java code, we are manually creating the XML document and also there is lot of code for appending child tags into the parent tags for creating the XML layout.
The code is unmaintainable.

I am in the process of simplifying this proces...

My question is that is it possible to generate a sample XML from XSD, and use freemarker to populate XML tag values from java objects at runtime...is this a good way to achieve what I intend, or do I need to follow some different path like XSLT or something else.


SCJP2, SCWCD
Rakesh Jhamb
Ranch Hand

Joined: Jun 18, 2003
Posts: 154
I request ranchers to please reply to my post.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18135
    
    8

Rakesh Jhamb wrote:I have a predefined XML schema (XSD file). I need to generate a XML according to that XSD and populate the tag values from Java Objects......


Okay. There are a lot of products which allow you to map Java objects to XML documents. JAXB is just one of them, for example.

I don't know anything about Freemarker but I looked at their FAQ and it doesn't include the word "schema".
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML Generation with Freemarker Templates.
 
Similar Threads
Generate XML using XSD and data in CSV
How to read from XSD generated database and put that data into XML file.
Exception occurs when using s2 tags in *.ftl
Reading XML using the XSD schema file.
Facade design pattern in web services