Re: Beginner question: Accessing XML-Attributes via Template?
"Tarik M." <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Hello,
thanks a lot for the example. I read the tutorial several times, but I
wasn't able to navigate through my XML-Document hierarchy. Whatever I've
tried I got the following Exception:
Expecting a string, date or number here, Expression
bdd.bisgridWorkflow.wsbpelEngineInformation.@wsbpelProcess is instead a
freemarker.ext.dom.NodeListModel
In the template I defined:
<process name="${doc.bWorkflow.wsbpelEngineInformation.@wsbpelProcess}">
Here is the XML part:
<bdd:bWorkflow xsi:schemaLocation="..." xmlns:bdd="..." xmlns:xsi="...">
<bdd:wsbpelEngineInformation wsbpelProcess="..."
wsbpelProcesslocation="...">
....
I thought that this is the way to navigate through the DOM-Tree, because the
tutorial examples show the same. Does anybody know what's wrong in my
example?
Thanks in advance.
Tarik
Daniel Lopez-3 wrote:
>
> 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
> _______________________________________________
> FreeMarker-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>
>
--
View this message in context: http://www.nabble.com/Beginner-question%3A-Accessing-XML-Attributes-via-Template--tp22649717p22671781.html
Sent from the freemarker-user mailing list archive at Nabble.com.
------------------------------------------------------------------------------
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
_______________________________________________
FreeMarker-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freemarker-user