Re: FreeMarker for newbies

Angelo zerr <[email protected]> Wed, 10 Jul 2013 15:38:33 +0200
Newsgroups gmane.comp.web.freemarker.user
Message-ID <CAKLdLg_qf-d-dd9AeB_3-NeqtNWotMhoX=VMArr23s2t+Vm+gA@mail.gmail.com>
Hi Eyal,

If I understand your need :


2013/7/10 Eyal <[email protected]>

> Hi,
>
> I'll explain in details.
>
> I want to generate an XML file, that I have some of its general structure,
> but some elements should be added in runtime.
>

You have an existing XML file.


>
> The way I understood, I can create a template for the XML elements that I
> need to calculate during runtime.
>

You wish to use Freemarker to generate an XML element (in a string).

>
> The missing information for me is- How do I process the template- that the
> result will be added to the correct location in the XML file
>

You wish  insert the XML element string in the existing XML file in a
special location.

If it that I had worked about this topic in the Akrogen Eclipse Plugin
http://akrogen.sourceforge.net/ several years ago.
My idea to insert (generated) XML element in special location is :

1) load XML file in a DOM document
2) generate XML element in a string by using Freemarker
3) load the generfated XML element in a DOM element
4) Insert the DOM element in the DOM document (you can retrieve node
location with XPath for instance or getElementsByTagName)
5) write the new DOM document in the file.

The important question is : do you wish keep the indentation, blank etc in
the XML file after inserting the generated XML element).
If you wish to do that, I had worked about this topic, but I don't remember
how I have done that.

Regards Angelo

You load your


>
>
> --
> View this message in context:
> http://freemarker.624813.n4.nabble.com/FreeMarker-for-newbies-tp4654620p4654622.html
> Sent from the freemarker-user mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> FreeMarker-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk

_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user