Methods Summary |
---|
public boolean | getFeature(java.lang.String name)Get the state of the named feature.
Feature names are fully qualified {@link java.net.URI}s.
Implementations may define their own features.
An {@link XPathFactoryConfigurationException} is thrown if this
XPathFactory or the XPath s
it creates cannot support the feature.
It is possible for an XPathFactory to expose a feature
value but be unable to change its state.
// feature name cannot be null
if (name == null) {
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_GETTING_NULL_FEATURE,
new Object[] { CLASS_NAME } );
throw new NullPointerException( fmsg );
}
// secure processing?
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
return featureSecureProcessing;
}
// unknown feature
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_GETTING_UNKNOWN_FEATURE,
new Object[] { name, CLASS_NAME } );
throw new XPathFactoryConfigurationException( fmsg );
|
public boolean | isObjectModelSupported(java.lang.String objectModel)Is specified object model supported by this
XPathFactory ?
if (objectModel == null) {
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_OBJECT_MODEL_NULL,
new Object[] { this.getClass().getName() } );
throw new NullPointerException( fmsg );
}
if (objectModel.length() == 0) {
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_OBJECT_MODEL_EMPTY,
new Object[] { this.getClass().getName() } );
throw new IllegalArgumentException( fmsg );
}
// know how to support default object model, W3C DOM
if (objectModel.equals(XPathFactory.DEFAULT_OBJECT_MODEL_URI)) {
return true;
}
// don't know how to support anything else
return false;
|
public javax.xml.xpath.XPath | newXPath()Returns a new XPath object using the underlying
object model determined when the factory was instantiated.
return new com.sun.org.apache.xpath.internal.jaxp.XPathImpl(
xPathVariableResolver, xPathFunctionResolver,
featureSecureProcessing );
|
public void | setFeature(java.lang.String name, boolean value)Set a feature for this XPathFactory and
XPath s created by this factory.
Feature names are fully qualified {@link java.net.URI}s.
Implementations may define their own features.
An {@link XPathFactoryConfigurationException} is thrown if this
XPathFactory or the XPath s
it creates cannot support the feature.
It is possible for an XPathFactory to expose a feature
value but be unable to change its state.
See {@link javax.xml.xpath.XPathFactory} for full documentation
of specific features.
// feature name cannot be null
if (name == null) {
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_FEATURE_NAME_NULL,
new Object[] { CLASS_NAME, new Boolean( value) } );
throw new NullPointerException( fmsg );
}
// secure processing?
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
featureSecureProcessing = value;
// all done processing feature
return;
}
// unknown feature
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_FEATURE_UNKNOWN,
new Object[] { name, CLASS_NAME, new Boolean(value) } );
throw new XPathFactoryConfigurationException( fmsg );
|
public void | setXPathFunctionResolver(javax.xml.xpath.XPathFunctionResolver resolver)Establish a default function resolver.
Any XPath objects constructed from this factory will use
the specified resolver by default.
A NullPointerException is thrown if
resolver is null .
// resolver cannot be null
if (resolver == null) {
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_NULL_XPATH_FUNCTION_RESOLVER,
new Object[] { CLASS_NAME } );
throw new NullPointerException( fmsg );
}
xPathFunctionResolver = resolver;
|
public void | setXPathVariableResolver(javax.xml.xpath.XPathVariableResolver resolver)Establish a default variable resolver.
Any XPath objects constructed from this factory will use
the specified resolver by default.
A NullPointerException is thrown if resolver is null .
// resolver cannot be null
if (resolver == null) {
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_NULL_XPATH_VARIABLE_RESOLVER,
new Object[] { CLASS_NAME } );
throw new NullPointerException( fmsg );
}
xPathVariableResolver = resolver;
|