at.newmedialab.ldpath.template.engine
Class LDPathDirective<Node>
java.lang.Object
at.newmedialab.ldpath.template.engine.LDPathDirective<Node>
- All Implemented Interfaces:
- freemarker.template.TemplateDirectiveModel, freemarker.template.TemplateModel
public class LDPathDirective<Node>
- extends Object
- implements freemarker.template.TemplateDirectiveModel
A directive for inserting values retrieved with LDPath. It can be used in several forms:
Value Insertion (without body):
Allows inserting the value of a path expression. The path expression should specify an XML schema type for the
type conversion. If no type is given, string conversion is assumed. If the expression would return several values,
only the first result is taken.
<@ldpath path="... :: xsd:type">
Value Iteration (with body):
Allows iterating over result nodes of a path expression. Further path expressions can be used to select the
values of each result node.
<@ldpath path="...">
...
<@ldpath path="...">
...
</@ldpath>
If a loop variable is given, it will be bound to the context node. The context node is also implicitly available
as the variable "context".
Author: Sebastian Schaffert
| Fields inherited from interface freemarker.template.TemplateModel |
NOTHING |
|
Method Summary |
void |
execute(freemarker.core.Environment env,
Map params,
freemarker.template.TemplateModel[] loopVars,
freemarker.template.TemplateDirectiveBody body)
Executes this user-defined directive; called by FreeMarker when the user-defined
directive is called in the template. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LDPathDirective
public LDPathDirective(RDFBackend<Node> backend)
execute
public void execute(freemarker.core.Environment env,
Map params,
freemarker.template.TemplateModel[] loopVars,
freemarker.template.TemplateDirectiveBody body)
throws freemarker.template.TemplateException,
IOException
- Executes this user-defined directive; called by FreeMarker when the user-defined
directive is called in the template.
- Specified by:
execute in interface freemarker.template.TemplateDirectiveModel
- Parameters:
env - the current processing environment. Note that you can access
the output Writer by Environment.getOut().params - the parameters (if any) passed to the directive as a
map of key/value pairs where the keys are String-s and the
values are TemplateModel instances. This is never
null. If you need to convert the template models to POJOs,
you can use the utility methods in the freemarker.template.utility.DeepUnwrap class.loopVars - an array that corresponds to the "loop variables", in
the order as they appear in the directive call. ("Loop variables" are out-parameters
that are available to the nested body of the directive; see in the Manual.)
You set the loop variables by writing this array. The length of the array gives the
number of loop-variables that the caller has specified.
Never null, but can be a zero-length array.body - an object that can be used to render the nested content (body) of
the directive call. If the directive call has no nested content (i.e., it is like
[@myDirective /] or [@myDirective][/@myDirective]), then this will be
null.
- Throws:
freemarker.template.TemplateException
IOException
Copyright © 2012 Salzburg Research. All Rights Reserved.