Re: Beginner question: Accessing XML-Attributes via Template?

Daniel López <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Hi,

The first place you can go to see how to handle XML content from a 
FreeMarker template is the manual itself ->
Part III.  XML Processing Guide:
http://freemarker.sourceforge.net/docs/xgui.html

Then you can see a working example like the one we have through FishEye:
A sample XML document:
http://fisheye5.cenqua.com/browse/webleaftest/src-www/WEB-INF/xml/showItems.xml?r=1.2
The FreeMarker template:
http://fisheye5.cenqua.com/browse/webleaftest/src-www/WEB-INF/templates/item.ftl?r=1.2
The resulting HTML:
http://fisheye5.cenqua.com/browse/webleaftest/src-www/showItems.html?r=1.4

S!
D.

Tarik Mustafic escribió:
> Hello everybody,
> 
> I'm trying to parse a XML-Document with Freemarker and to merge the
> model with a template, especially accessing the XML-Attributes from the
> model.  I have done the following:
> 
> --------------------- code
> Map<String, Object> root = new HashMap<String, Object>();
> root.put("doc", freemarker.ext.dom.NodeModel.parse(new File("file.xml")));
> --------------------- code
> 
> The XML-document looks like as follows:
> 
> --------------------- code
> <?xml version="1.0" encoding="UTF-8"?>
> <bdd:bWorkflow xsi:schemaLocation="..." xmlns:bdd="..." xmlns:xsi="...">
>     <bdd:wsbpelEngineInformation wsbpelProcess="..."
> wsbpelProcesslocation="...">
>         <bdd:versioning version="..."/>
>         <bdd:persistence storePersistent="..."/>
>         <bdd:partnerLinks>
>             <bdd:partnerLink name="...">
>                 <bdd:myRole>
>                     <bdd:endpointReference
>                         serviceName="..."
>                         servicePort="..."
>                         binding="..."
>                         xmlns:pal="..."/>
>                 </bdd:myRole>
>             </bdd:partnerLink>
>             <bdd:partnerLink name="...">
>                 <bdd:partnerRole bdd:serviceType="..."
> bdd:serviceCall="..."/>
>             </bdd:partnerLink>
>         </bdd:partnerLinks>
>         <bdd:extensions/>
>         <bdd:references>
>             <bdd:reference location="..." referenceGroup="..."
> namespace="..."/>
>             <bdd:reference location="..." referenceGroup="..."
> namespace="..."/>
>         </bdd:references>
>     </bdd:wsbpelEngineInformation>
> </bdd:bWorkflow>
> --------------------- code
> 
> Now my question: How can I access the XML-Attribute elements in the
> Template? For example how to get the version-Attribute of the
> versioning-Element etc?
> 
> Thanks in advance.
> 
> Kind regards.
> Tarik


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
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.