Dominique Devienne wrote:
From: Jose Alberto Fernandez [mailto:[EMAIL PROTECTED]
Hey Peter, can't you code that? ;-) --DD
It already exists, it is called velocity. ;-)
I always thought velocity was a templating tool, so I don't see it's relation to calling arbitrary methods on objects referred to from Ant references... --DD
It's just the velocity property stuff that's really used here. Here is the example of all this stuff.
From: http://cvs.apache.org/viewcvs.cgi/ant/proposal/embed/test.xml?view=markup
<target name="dynamicProperties" depends="init">
<taskdef classname="org.apache.tools.ant.taskdefs.optional.JXPath"
name="jxpath" />
<taskdef classname="org.apache.tools.ant.taskdefs.optional.JXPathSet"
name="jxpathSet" />
<taskdef classname="org.apache.tools.ant.taskdefs.optional.VelocityProperties"
name="velocityProperties" />
<taskdef classname="org.apache.tools.ant.taskdefs.optional.JexlProperties"
name="jexlProperties" />
<!-- Init JxPath. '/' is the project --> <jxpath/> <velocityProperties/> <jexlProperties/>
<echo id="foo" message="Starting dynamic props tests" />
<echo message="Value: ${vm:$ant.references.jxpathTask.foo}" /> <jxpathSet path="/[EMAIL PROTECTED]'jxpathTask']/foo" value="Test"/> <echo message="Value: ${vm:$ant.references.jxpathTask.foo}" />
<echo message="${jexl:ant.references.jxpathTask.foo=bar}" /> <echo message="Value: ${vm:$ant.references.jxpathTask.foo}" />
<echo message="jexl /references/myJars: ${jexl:ant.references.myJars}" />
<echo message="jxPath /targets[1]: ${jxpath:/targets[1]}" />
<echo message="jxPath /references: ${jxpath:/references}" />
<echo message="jxPath /[EMAIL PROTECTED]'myJars']: ${jxpath:/[EMAIL PROTECTED]'myJars']}" />
<echo message="jxPath /references/myJars: ${jxpath:/references/myJars}" />
<!-- This is XMLDOM.java - a datatype that holds an xml DOM --> <typedef name="xmldom" classname="org.apache.tools.ant.taskdefs.XMLDOM"/>
<!-- Init XMLDOM. The DOM of file test.xml will be referenced via the id--> <xmldom id="test.xml" file="test.xml"/>
<echo message="XMLDOM: ${jxpath:/references/test.xml/root/project/@name}" />
</target>
-- Nicola Ken Barozzi [EMAIL PROTECTED] - verba volant, scripta manent - (discussions get forgotten, just code remains) ---------------------------------------------------------------------
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]