|
|||||||||
| 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 8.X (tested with 8.5), 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" [delimiter="delimiter"] [backwardscompatible="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. delimiter -> The delimiter character or sequence of each of the results (default is ",") backwardscompatible -> Set XPath 1.0 compatibility mode on or off (by default, it is 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.
| Nested Class Summary | |
class |
XPath.Namespace
|
| 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 | |
XPath.Namespace |
createNamespace()
|
void |
execute()
Execute this task. |
void |
setBackwardscompatible(java.lang.String backwardscompatible)
Set wether we should be compatible with XPath 1.0 or not. |
void |
setDelimiter(java.lang.String delimiter)
Set the delimiter character/characters of each one of the query results. |
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. |
| 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 setBackwardscompatible(java.lang.String backwardscompatible)
backwardscompatible - true or false, depending on the compatibility with XPath 1.0 (default is false)public void setDelimiter(java.lang.String delimiter)
delimiter - the results separator.public XPath.Namespace createNamespace()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||