|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
net.uworks.andariel.XPath
Task definition for an ANT task that performs a XPath query on a XML file. This task uses the Saxon processor, which should be located in the same classpath as ANT.
Usage: Task declaration in the project:<taskdef name="xpath" classname="net.uworks.andariel.XPath" />Task calling syntax:<xpath file="file" expression="expression" outputproperty="outputproperty" [separator="separator"] [count="true|false"] />Attributes: file -> The filename of the XML we want to perform the query on. outputproperty -> The name of the property where we want to store the result. separator -> The separator of the results (default is ",") count -> Defines if we want the list of results or if we just want the number of results (defaults to false) Crude Example:<xpath file="build.xml" expression="/project/target/@name" outputproperty="targetNames" />This example retrieves the names of all the targets from a build.xml file.
| Field Summary |
| Fields inherited from class org.apache.tools.ant.Task |
description, location, target, taskName, taskType, wrapper |
| Fields inherited from class org.apache.tools.ant.ProjectComponent |
project |
| Constructor Summary | |
XPath()
|
|
| Method Summary | |
void |
execute()
Execute this task. |
void |
setCount(java.lang.String wantCount)
Set if we only want to count the results of a certain expression. |
void |
setExpression(java.lang.String expression)
Set the expression we want to perform over the XML file. |
void |
setFile(java.lang.String file)
Set the filename of the XML file we want to check. |
void |
setOutputproperty(java.lang.String outputproperty)
Set the name of the property were we want to store the result of the query. |
void |
setSeparator(java.lang.String separator)
Set the separator character/characters of each one of the query results. |
| Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
| Methods inherited from class org.apache.tools.ant.ProjectComponent |
getProject, setProject |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public XPath()
| Method Detail |
public void execute()
throws org.apache.tools.ant.BuildException
org.apache.tools.ant.BuildException - Description of the Exceptionpublic void setFile(java.lang.String file)
file - the filename of the XML file.public void setExpression(java.lang.String expression)
expression - the XPath expression.public void setOutputproperty(java.lang.String outputproperty)
outputproperty - the name of the output property.public void setSeparator(java.lang.String separator)
separator - the results separator.public void setCount(java.lang.String wantCount)
wantCount - enables or disables the count mode.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||