org.inria.ns.reflex.xml
Class QExpression

java.lang.Object
  extended by org.inria.ns.reflex.xml.QExpression
Direct Known Subclasses:
QExpression.QNameWrapper

public abstract class QExpression
extends Object

A QName given by an expression. If the expression is resoved to a string that contains a colon, the QName should have a namespace URI ; if no namespace URI is bound to the prefix, the QName is simply a local-name without namespace URI.

Author:
Philippe Poulard
See Also:
Expression, QName

Nested Class Summary
static class QExpression.QNameWrapper
          A QExpression that simply wraps a QName.
 
Constructor Summary
QExpression()
           
 
Method Summary
abstract  QName getQName(XPathVariableResolver variableResolver)
          Provides a runtime computation of the compiled expression using the given dataset.
static QExpression parseValueTemplate(Element element, String attributeName)
          Parses an expression string from an element's attribute, as an attribute value template to a compiled QExpression.
static QExpression parseValueTemplate(Element element, String attributeName, XFactory factory)
          Parses an expression string from an element's attribute, as an attribute value template to a compiled QExpression.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QExpression

public QExpression()
Method Detail

getQName

public abstract QName getQName(XPathVariableResolver variableResolver)
                        throws XPathException
Provides a runtime computation of the compiled expression using the given dataset.

Parameters:
variableResolver - The resolver used to retrieve the variables used for the computation.
Returns:
The result of the evaluated expression, as a QName.
Throws:
XPathException - When the expression rises an XPath error at runtime.

parseValueTemplate

public static QExpression parseValueTemplate(Element element,
                                             String attributeName)
                                      throws XPathException
Parses an expression string from an element's attribute, as an attribute value template to a compiled QExpression.

Parameters:
element - The element to which belongs the attribute. Used for namespace prefix resolution when performing XPath expressions.
attributeName - The name of the attribute that contains the expression to parse.
Returns:
The compiled QExpression.
Throws:
XPathException - If the given expression is not a valid XPath expression.

parseValueTemplate

public static QExpression parseValueTemplate(Element element,
                                             String attributeName,
                                             XFactory factory)
                                      throws XPathException
Parses an expression string from an element's attribute, as an attribute value template to a compiled QExpression.

Parameters:
element - The element to which belongs the attribute. Used for namespace prefix resolution when performing XPath expressions.
attributeName - The name of the attribute that contains the expression to parse.
factory - The factory to use to parse XPath expressions.
Returns:
The compiled QExpression.
Throws:
XPathException - If the given expression is not a valid XPath expression.