net.sf.saxon.xpath
Class XPathFactoryImpl

java.lang.Object
  extended by javax.xml.xpath.XPathFactory
      extended by net.sf.saxon.xpath.XPathFactoryImpl
Direct Known Subclasses:
SchemaAwareXPathFactory

public class XPathFactoryImpl
extends XPathFactory

Saxon implementation of the JAXP 1.3 XPathFactory


Field Summary
 
Fields inherited from class javax.xml.xpath.XPathFactory
DEFAULT_OBJECT_MODEL_URI, DEFAULT_PROPERTY_NAME
 
Constructor Summary
XPathFactoryImpl()
          Default constructor: this creates a Configuration as well as creating the XPathFactory.
XPathFactoryImpl(Configuration config)
          Constructor using a user-supplied Configuration.
 
Method Summary
 Configuration getConfiguration()
          Get the Configuration object used by this XPathFactory
 boolean getFeature(String feature)
          Get a feature of this XPath implementation.
 boolean isObjectModelSupported(String model)
          Test whether a given object model is supported.
 XPath newXPath()
          Create an XPath evaluator
 void setFeature(String feature, boolean b)
          Set a feature of this XPath implementation.
 void setXPathFunctionResolver(XPathFunctionResolver xPathFunctionResolver)
          Set a resolver for XPath functions.
 void setXPathVariableResolver(XPathVariableResolver xPathVariableResolver)
          Set a resolver for XPath variables.
 
Methods inherited from class javax.xml.xpath.XPathFactory
newInstance, newInstance
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPathFactoryImpl

public XPathFactoryImpl()
Default constructor: this creates a Configuration as well as creating the XPathFactory. Any documents accessed using this XPathFactory must be built using this same Configuration.


XPathFactoryImpl

public XPathFactoryImpl(Configuration config)
Constructor using a user-supplied Configuration. This constructor is useful if the document to be queried already exists, as it allows the configuration associated with the document to be used with this XPathFactory.

Parameters:
config - the Saxon configuration
Method Detail

getConfiguration

public Configuration getConfiguration()
Get the Configuration object used by this XPathFactory

Returns:
the Saxon configuration

isObjectModelSupported

public boolean isObjectModelSupported(String model)
Test whether a given object model is supported. Returns true if the object model is the Saxon object model, DOM, JDOM, DOM4J, or XOM

Specified by:
isObjectModelSupported in class XPathFactory
Parameters:
model - The URI identifying the object model.
Returns:
true if the object model is one of NamespaceConstant.OBJECT_MODEL_SAXON, XPathConstants.DOM_OBJECT_MODEL, NamespaceConstant.OBJECT_MODEL_JDOM, or NamespaceConstant.OBJECT_MODEL_XOM, or NamespaceConstant.OBJECT_MODEL_DOM4J

setFeature

public void setFeature(String feature,
                       boolean b)
                throws XPathFactoryConfigurationException
Set a feature of this XPath implementation. The only features currently recognized are:

Specified by:
setFeature in class XPathFactory
Parameters:
feature - a URI identifying the feature
b - true to set the feature on, false to set it off
Throws:
XPathFactoryConfigurationException - if the feature name is not recognized

getFeature

public boolean getFeature(String feature)
                   throws XPathFactoryConfigurationException
Get a feature of this XPath implementation. The only features currently recognized are:

Specified by:
getFeature in class XPathFactory
Parameters:
feature - a URI identifying the feature
Returns:
true if the feature is on, false if it is off
Throws:
XPathFactoryConfigurationException - if the feature name is not recognized

setXPathVariableResolver

public void setXPathVariableResolver(XPathVariableResolver xPathVariableResolver)
Set a resolver for XPath variables. This will be used to obtain the value of any variable referenced in an XPath expression. The variable resolver must be allocated before the expression is compiled, but it will only be called when the expression is evaluated.

Specified by:
setXPathVariableResolver in class XPathFactory
Parameters:
xPathVariableResolver - The object used to resolve references to variables.

setXPathFunctionResolver

public void setXPathFunctionResolver(XPathFunctionResolver xPathFunctionResolver)
Set a resolver for XPath functions. This will be used to obtain an implementation of any external function referenced in an XPath expression. This is not required for system functions, Saxon extension functions, constructor functions named after types, or extension functions bound using a namespace that maps to a Java class.

Specified by:
setXPathFunctionResolver in class XPathFactory
Parameters:
xPathFunctionResolver - The object used to resolve references to external functions.

newXPath

public XPath newXPath()
Create an XPath evaluator

Specified by:
newXPath in class XPathFactory
Returns:
an XPath object, which can be used to compile and execute XPath expressions.


Copyright (C) Michael H. Kay. All rights reserved.