Re: XMLProcessing : how to embed full xml element in template

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Did you try @@markup and such?
See: http://freemarker.org/docs/xgui_imperative_formal.html

-- 
Best regards,
 Daniel Dekany

Tuesday, February 12, 2008, 2:06:50 PM, thierry henrio wrote:

> Hi, all
> First, thanks Dany for your responses on my previous "XMLProcessing*" posts
> I have now reached the end of my document, all is fine  
>
> at the end they're are these
> <ims>
> <!-- end -->
> <reconnecter filter="slc" period="5000" maxAttempts="10" />
> <reconnecter filter="sle.*" period="5000" maxAttempts="10" bg="true" maxWaitTime="10000"/>
> </ims>
>
> the <reconnecter> element has many more "optionnal" parameters, and
> testing for all optionnal would cause "heavy" templating syntax
> one way i considered is "told the template : just put the xml, as it is in model"
>
> something like
> <#list ims.reconnecter as r>
>     ${r}
> </#list>
>
> this is "fine", but does match my need : i've got no <reconnecter>
> at all after template processing but empty lines ...
>
> so i was wondering how to achieve this ...
> i tried a hash model with {("document", above node model), ("pojo", a rendering pojo)}
>     SimpleHash model = new SimpleHash();
>     model.put("document", NodeModel.parse(myXmlFile));
>     model.put("pojo", BeansWrapper.getDefaultInstance().wrap(pojo));
>
> and something like
> <#list document.ims.reconnecter as r>
>     ${pojo.render(r)}
> </#list>
>
> ok, that "works" : i've got things like
> <?xml version="1.0" encoding="UTF-8"?><reconnecter filter="slc" maxAttempts="10" period="5000"/>
> (i shall enhance the render method of this pojo  
>
> one thing that "shames" me in my approach is that it brings one "document" indirection
> it is no more "ims.reconnecter" but "document.ims.reconnecter" ...
> i was unable to add my pojo in the above NodeModel : there is no "put" method in NodeModel
>
> is there another means of achieving what i want ?
>
> Regards, Thierry



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.