Hello Velocity community,

the folowing little patch is usefull for me ... it allows me accessing an
XML document via Texen ...

I now Anakia to things better, but in Anakia you has no $generator ... :-(


Chris


Index: TexenTask.java
===================================================================
RCS file:
/home/cvspublic/jakarta-velocity/src/java/org/apache/velocity/texen/ant/Texe
nTask.java,v
retrieving revision 1.35
diff -r1.35 TexenTask.java
78a79,81
> import org.jdom.input.SAXBuilder;
> import org.jdom.Document;
> import org.jdom.JDOMException;
84a88
>  * @author <a mailto:href="[EMAIL PROTECTED]>Christian Trutz</a>
156a161,170
>      * <p>
>      * This is a org.jdom.Document that is fed into the
>      * initial context from a parsed XML file. This
>      * is simply a convenient way to make a parsed
>      * XML file available in the context via $xmlDocument.
>      * </p>
>      */
>     protected Document contextXML;
>
>     /**
341c355,388
<     }
---
>     }
>
>     /**
>      * Get the org.jdom.Document that is fed into the
>      * initial context via $xmlDocument.
>      */
>     public Document getContextXML()
>     {
>         return contextXML;
>     }
>
>     /**
>      * Set the context XML file
>      *
>      * @param File is an XML file to be parsed, the
>      * org.jdom.Document of this XML file is fed into the
>      * initial context via $xmlDocument.
>      */
>     public void setContextXML (File xmlFile) throws BuildException
>     {
>         try
>         {
>             SAXBuilder builder = new SAXBuilder();
>             this.contextXML = builder.build(xmlFile.getCanonicalPath());
>         }
>         catch (java.io.IOException ioe)
>         {
>             throw new BuildException(ioe);
>         }
>         catch (org.jdom.JDOMException ex)
>         {
>             throw new BuildException(ex);
>         }
>     }
570a618
>  context.put("xmlDocument", getContextXML());





Reply via email to