no.sesat.search.view.velocity
Class XPathForeachDirective

java.lang.Object
  extended by org.apache.velocity.runtime.directive.Directive
      extended by no.sesat.search.view.velocity.AbstractDirective
          extended by no.sesat.search.view.velocity.XPathForeachDirective
All Implemented Interfaces:
Cloneable, org.apache.velocity.runtime.directive.DirectiveConstants

public class XPathForeachDirective
extends AbstractDirective

Directive for moving through w3c dom node lists selected by an XPath expression. Example:

 #publish("/pages/xmlbase/cat.xml")
 #xpathforeach($item "/categories/item[greatprnt=33]")
   #xpath("catname" $item)
 #end
 
By default, the expression is applied to the value of the context variable "document". If there is a third argument the expression is applied to the value this argument instead. The argument should be a type of org.w3c.dom.Node.


Field Summary
 
Fields inherited from class org.apache.velocity.runtime.directive.Directive
rsvc
 
Fields inherited from interface org.apache.velocity.runtime.directive.DirectiveConstants
BLOCK, LINE
 
Constructor Summary
XPathForeachDirective()
           
 
Method Summary
 String getName()
          
 int getType()
          
 void init(org.apache.velocity.runtime.RuntimeServices runtimeServices, org.apache.velocity.context.InternalContextAdapter internalContextAdapter, org.apache.velocity.runtime.parser.node.Node node)
          
 boolean render(org.apache.velocity.context.InternalContextAdapter context, Writer writer, org.apache.velocity.runtime.parser.node.Node node)
           
 
Methods inherited from class no.sesat.search.view.velocity.AbstractDirective
getArgument, getDataModel, getObjectArgument
 
Methods inherited from class org.apache.velocity.runtime.directive.Directive
getColumn, getLine, setLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPathForeachDirective

public XPathForeachDirective()
Method Detail

init

public void init(org.apache.velocity.runtime.RuntimeServices runtimeServices,
                 org.apache.velocity.context.InternalContextAdapter internalContextAdapter,
                 org.apache.velocity.runtime.parser.node.Node node)
          throws org.apache.velocity.exception.TemplateInitException

Overrides:
init in class org.apache.velocity.runtime.directive.Directive
Throws:
org.apache.velocity.exception.TemplateInitException

getName

public String getName()

Specified by:
getName in class org.apache.velocity.runtime.directive.Directive

getType

public int getType()

Specified by:
getType in class org.apache.velocity.runtime.directive.Directive

render

public boolean render(org.apache.velocity.context.InternalContextAdapter context,
                      Writer writer,
                      org.apache.velocity.runtime.parser.node.Node node)
               throws IOException,
                      org.apache.velocity.exception.ResourceNotFoundException,
                      org.apache.velocity.exception.ParseErrorException,
                      org.apache.velocity.exception.MethodInvocationException
Specified by:
render in class org.apache.velocity.runtime.directive.Directive
Throws:
IOException
org.apache.velocity.exception.ResourceNotFoundException
org.apache.velocity.exception.ParseErrorException
org.apache.velocity.exception.MethodInvocationException


Copyright © 2005-2009 Schibsted ASA. All Rights Reserved.