|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jet.XPathContextExtender
public final class XPathContextExtender
Context Extender that understands XPath processing.
Constructor Summary | |
---|---|
XPathContextExtender(JET2Context context)
Deprecated. Use getInstance(JET2Context) . This method will be made private in the near future. |
Method Summary | |
---|---|
void |
addCustomFunctions(XPathFunctionMetaData[] functionData)
Add the passed list of XPath function definitions to the XPath processor. |
java.lang.Object |
addElement(java.lang.Object parent,
java.lang.String name)
|
java.lang.Object |
addTextElement(java.lang.Object parentElement,
java.lang.String name,
java.lang.String bodyContent)
Create a new text (simple) element whose content is set to bodyContent . |
java.lang.Object |
addTextElement(java.lang.Object parentElement,
java.lang.String name,
java.lang.String bodyContent,
boolean asCData)
Create a new text (simple) element whose content is set to bodyContent . |
java.lang.Object |
copyElement(java.lang.Object srcElement,
java.lang.Object tgtParent,
java.lang.String name,
boolean recursive)
Copy srcElement as a new element with the specified name under tgtParent . |
protected java.lang.Object |
createExtendedData(JET2Context context)
|
java.lang.Object |
currentXPathContextObject()
Return the current XPath context object. |
java.lang.Object |
getAttributeValue(java.lang.Object element,
java.lang.String attributeName)
Return the value of the named attribute on the passed element. |
java.lang.String |
getContent(java.lang.Object object)
Return the string value of the passed object. |
static XPathContextExtender |
getInstance(JET2Context context)
Factory method for XPathContextExtenders |
java.lang.Object |
popXPathContextObject()
Restore the previous XPath context object. |
void |
pushXPathContextObject(java.lang.Object contextObject)
Push a new XPath context object. |
void |
removeAttribute(java.lang.Object element,
java.lang.String attributeName)
Remove the named attribute from the specified element. |
void |
removeElement(java.lang.Object element)
|
java.lang.Object[] |
resolve(java.lang.Object xpathContextObject,
java.lang.String selectXPath)
Resolve an XPath expression into an array of Objects. |
java.lang.Object[] |
resolve(java.lang.String selectXPath)
Resolve an XPath expression into an array of Objects. |
java.lang.Object |
resolveAsObject(java.lang.Object contextObject,
java.lang.String selectXPath)
Resolve the XPath expression, returning an object. |
java.lang.Object |
resolveAsObject(java.lang.String selectXPath)
Resolve the XPath expression, returning an object. |
java.lang.String |
resolveAsString(java.lang.Object xpathContextObject,
java.lang.String selectXPath)
Resolve the given XPath expression as a string value. |
java.lang.String |
resolveAsString(java.lang.String selectXPath)
Resolve the given XPath expression as a string value. |
java.lang.String |
resolveDynamic(java.lang.String value)
Resolve dynamic XPath expressions {...} within the pass value |
static java.lang.String |
resolveDynamic(java.lang.String value,
JET2Context context)
|
java.lang.Object |
resolveSingle(java.lang.Object xpathContextObject,
java.lang.String selectXPath)
Resolve an XPath expression to a single object. |
java.lang.Object |
resolveSingle(java.lang.String selectXPath)
Resolve an XPath expression to a single object. |
boolean |
resolveTest(java.lang.Object xpathContext,
java.lang.String testXPath)
Resolve an xpath expression as a boolean result according to the XPath rules. |
boolean |
resolveTest(java.lang.String textXPath)
Resolve an xpath expression as a boolean result according to the XPath rules. |
java.lang.Object |
resolveVariable(java.lang.String name)
|
boolean |
setAttribute(java.lang.Object element,
java.lang.String name,
java.lang.String bodyContent)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XPathContextExtender(JET2Context context)
getInstance(JET2Context)
. This method will be made private in the near future.
context
- Method Detail |
---|
public static XPathContextExtender getInstance(JET2Context context)
context
- the JET2Context that is extended
protected java.lang.Object createExtendedData(JET2Context context)
public java.lang.Object resolveVariable(java.lang.String name)
resolveVariable
in interface XPathVariableResolver
public java.lang.String resolveAsString(java.lang.Object xpathContextObject, java.lang.String selectXPath) throws JET2TagException
null
xpathContextObject
- the xpath contextselectXPath
- the XPath expression
null
if the expression resulted in an empty node set.
JET2TagException
- if an error occurs during expression evaluationpublic java.lang.String resolveAsString(java.lang.String selectXPath) throws JET2TagException
null
. This is a convenience implementation of:
resolveAsString(currentXPathContextObject(), selectXPath)
selectXPath
- the XPath expression
null
if the expression resulted in an empty node set.
JET2TagException
- if an error occurs during expression evaluationresolveAsString(Object, String)
public java.lang.Object resolveSingle(java.lang.Object xpathContextObject, java.lang.String selectXPath) throws JET2TagException
null
if that colleciton is empty. Otherwise, the result
of the XPath expression is returned.
xpathContextObject
- the context object used to resolve relative XPath expressionsselectXPath
- the Xpath expression
null
JET2TagException
- if an XPath error occurs.public java.lang.Object resolveSingle(java.lang.String selectXPath) throws JET2TagException
resolveSingle(currentXPathContextObject(), selectXPath)
selectXPath
- the Xpath expression
null
JET2TagException
- if an XPath error occurs.resolveSingle(Object, String)
public java.lang.Object currentXPathContextObject()
pushXPathContextObject(Object)
, then value of JET2Context.getSource()
is returned
public void pushXPathContextObject(java.lang.Object contextObject)
contextObject
- the object that will be the new XPath context objectcurrentXPathContextObject()
,
popXPathContextObject()
public java.lang.Object popXPathContextObject()
java.util.EmptyStackException
- if there is no prior XPath context to restore.currentXPathContextObject()
,
pushXPathContextObject(Object)
public java.lang.Object[] resolve(java.lang.Object xpathContextObject, java.lang.String selectXPath) throws JET2TagException
xpathContextObject
- the context object for relative Xpath expressionsselectXPath
- the XPath expression
JET2TagException
- if an error in the XPath expression occurspublic java.lang.Object[] resolve(java.lang.String selectXPath) throws JET2TagException
resolve(currentXPathContextObject(), selectXPath)
selectXPath
- selectXPath the XPath expression
JET2TagException
- if an error in the XPath expression occurspublic boolean resolveTest(java.lang.Object xpathContext, java.lang.String testXPath) throws JET2TagException
See the documentation of the XPathboolean function for complete details on how XPath results are converted to boolean values.
xpathContext
- the XPath context objecttestXPath
- the XPath expression
true
or false
JET2TagException
- if an error occurs in evaluating the expression.public boolean resolveTest(java.lang.String textXPath) throws JET2TagException
resolveTest(currentXPathContextObject(), textXPath)
testXPath
- the XPath expression
true
or false
JET2TagException
- if an error occurs in evaluating the expression.resolveTest(Object, String)
public boolean setAttribute(java.lang.Object element, java.lang.String name, java.lang.String bodyContent) throws JET2TagException
JET2TagException
public java.lang.String resolveDynamic(java.lang.String value) throws JET2TagException
value
- a string containing zero or more dynamic xpath expressions
JET2TagException
- if an Xpath evaluation error occurspublic static java.lang.String resolveDynamic(java.lang.String value, JET2Context context) throws JET2TagException
JET2TagException
public java.lang.Object addElement(java.lang.Object parent, java.lang.String name) throws JET2TagException
JET2TagException
public void removeElement(java.lang.Object element) throws JET2TagException
JET2TagException
public java.lang.Object copyElement(java.lang.Object srcElement, java.lang.Object tgtParent, java.lang.String name, boolean recursive) throws JET2TagException
srcElement
as a new element with the specified name under tgtParent
.
If recursive
is true
, then all the contained children of srcElement
are copied, otherwise, only the element and its attributes are copied.
srcElement
- the element to copytgtParent
- the parent element that will contain the copyname
- the name of the copied elementrecursive
- true
if contained chidren are to be copied, too.
JET2TagException
- an error occurspublic java.lang.Object addTextElement(java.lang.Object parentElement, java.lang.String name, java.lang.String bodyContent) throws JET2TagException
bodyContent
.
parentElement
- the parent of the new element.name
- the name of the new element.bodyContent
- the content.
JET2TagException
- if the element cannot be added.public java.lang.Object addTextElement(java.lang.Object parentElement, java.lang.String name, java.lang.String bodyContent, boolean asCData) throws JET2TagException
bodyContent
.
parentElement
- the parent of the new element.name
- the name of the new element.bodyContent
- the content.asCData
- if true
, create the element as a CDATA section, of possible
JET2TagException
- if the element cannot be added.public java.lang.Object resolveAsObject(java.lang.Object contextObject, java.lang.String selectXPath) throws JET2TagException
contextObject
- the context object to which the XPath expression is relative.selectXPath
- the XPath expression
JET2TagException
- if an error occurs.public java.lang.Object resolveAsObject(java.lang.String selectXPath) throws JET2TagException
resolveAsObject(currentXPathContextObject(), selectXPath);
selectXPath
- the XPath expression
JET2TagException
- if an error occurs.resolveAsObject(Object, String)
public java.lang.Object getAttributeValue(java.lang.Object element, java.lang.String attributeName) throws JET2TagException
element
- the element containing the attributeattributeName
- the attribute name
JET2TagException
public void removeAttribute(java.lang.Object element, java.lang.String attributeName) throws JET2TagException
element
- the element containing the attributeattributeName
- the attribute to remove
JET2TagException
- if the attribute cannot be removed (because it is required),
or if element
is not a recognized element.public java.lang.String getContent(java.lang.Object object) throws JET2TagException
object
- the object to examine.
JET2TagException
- if an error occurs.public void addCustomFunctions(XPathFunctionMetaData[] functionData)
functionData
- possible empty array of XPathFunctionMetaData
instances.
|
Copyright 2006 IBM Corporation and others. All Rights Reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |