• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML Generation with Freemarker Templates.

 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rakesh Jhamb
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I request ranchers to please reply to my post.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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".
 
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic