Adding namespaces to .ftl
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2007 08:45 AM
Hi!
Im trying to process a XML document like
Im trying to process a XML document like
<a:blabla> <b:blabla> <c:somestuff>xxx</c:somestuff> </b:blabla></a:blabla>
via freemarker template, which offering entering namespaces like<#ftl ns_prefixes={"a", "http://www.something.org/somewhere","b","http://something.else/somewhere/"}
but i cant pass this notation through "alfresco version" of FreeMarker. Can someone please help me, how can i manipulate with that document? Thanks a lot!
Labels:
- Labels:
-
Archive
8 REPLIES 8
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2007 09:23 AM
Hi
Have you got the correct syntax? I thought the ftl directive should be more like:
Have you got the correct syntax? I thought the ftl directive should be more like:
<#ftl ns_prefixes={"a":"http://www.something.org/somewhere","b":"http://something.else/somewhere/"}>
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2007 09:35 AM
thanks for response!
yes, i use the right form, i think, i made mistake just by entering information to forum, my copy&paste:
yes, i use the right form, i think, i made mistake just by entering information to forum, my copy&paste:
<#ftl ns_prefixes={"are":"http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_answer_or/v_1.0.3","D":"http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_datatypes/v_1.0.3","U":"http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/uvis_datatypes/v_1.0.3"}>
and on "tomcat console"…Caused by: freemaker.core.ParseException: Encountered "<#ftl " at line 2…Was expecting one of:<ATTEMPT>…
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2007 10:28 AM
Two things possibly causing this…
1. The <#ftl ..> has to be the very first line of the template (your error is occurring on Line 2)
2. The "D" namespace is reserved by Freemarker (as is the "N" prefix) unless you're sure you know you want to override it.
Thanks,
Mike
1. The <#ftl ..> has to be the very first line of the template (your error is occurring on Line 2)
2. The "D" namespace is reserved by Freemarker (as is the "N" prefix) unless you're sure you know you want to override it.
Thanks,
Mike
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2007 11:47 AM
Oh, many thanks, that is the problem, i think!!! 😉
And one more question…is there any tutorial, or example? I really dont know how to access my structure. I followed http://www.freemarker.org/docs/xgui_imperative_learn.html and http://wiki.alfresco.com/wiki/Template_Guide but my notation still not work.
Thanks in advance!
And one more question…is there any tutorial, or example? I really dont know how to access my structure. I followed http://www.freemarker.org/docs/xgui_imperative_learn.html and http://wiki.alfresco.com/wiki/Template_Guide but my notation still not work.
<?xml version="1.0" ?><are:Ares_odpovedi xmlns:are="http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_answer_or/v_1.0.3" Id="Ares_odpoved"> <are:Odpoved> somestuff <bbb:Odpoved2> someotherstuff </bbb:Odpoved2> </are:Odpoved></are:Ares_odpovedi>
and something like…<#list document.childrenByXPath[".//*[subtypeOf('are:Ares_odpovedi')]"] as odpovedi> ${odpovedi.content["are:Odpoved"]} </#list>…
or…<#assign dom=document.xmlNodeModel /> <#list dom.content["are:Ares_odpovedi"] as cosi> <h1>${cosi.content["are:Odpoved"]}</h1> </#list>…
(and what about <bbbdpoved2>?)Thanks in advance!
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2007 11:50 AM
This article should help:
http://wiki.alfresco.com/wiki/Forms_Developer_Guide#Simple_examples_using_Freemarker_templates
thanks,
Mike
http://wiki.alfresco.com/wiki/Forms_Developer_Guide#Simple_examples_using_Freemarker_templates
thanks,
Mike
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2007 12:07 PM
Thanks for fast response again, but those routines i tried, but without result too, or is there any other error in my notation?
<?xml version="1.0" ?><are:Ares_odpovedi xmlns:are="http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_answer_or/v_1.0.3"> <are:Odpoved> some_plain_text_stuff </are:Odpoved></are:Ares_odpovedi>
<#ftl ns_prefixes={"are":"http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_answer_or/v_1.0.3"}>${.vars["are:Ares_odpovedi/are:Odpoved"]}
Error during processing of the template 'Expression .vars["are:Ares_odpovedi/are:Odpoved"] is undefined on line 3, column 3 in workspace://SpacesStore/1abe32d0-71af-11dc-9d7c-4531dcb10a32.'. Please contact your system administrator.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2007 03:35 PM
I'm not sure why the .vars syntax isn't working, but you should also be able to do something like:
Mike
${Ares_odpovedi.Odpoved}
Mike
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2007 04:09 AM
Thanks, but this syntax doesnt work too :-(.
<#ftl ns_prefixes={"are":"http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_answer_or/v_1.0.3"}>${Ares_odpovedi.Odpoved}
generates (even thought its defined a line above)Error during processing of the template 'Expression Ares_odpovedi is undefined on line 2, column 3 in workspace://SpacesStore/1abe32d0-71af-11dc-9d7c-4531dcb10a32.'. Please contact your system administrator.
Nor this one<#ftl ns_prefixes={"are":"http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_answer_or/v_1.0.3"}><#assign Ares_odpovedi = .vars["are:Ares_odpovedi"]>
generatesError during processing of the template 'Error on line 3, column 1 in workspace://SpacesStore/1abe32d0-71af-11dc-9d7c-4531dcb10a32 .vars["are:Ares_odpovedi"] is undefined. It cannot be assigned to Ares_odpovedi'. Please contact your system administrator.