/**
* Creates a new XPath with a given namespace context.
*
* @param namespaceContext The namespace context to be used or null
* if none should be used.
* @param resolver The name space resolver.
* @return The new XPath
*/
public static final XPath newXPath(
NamespaceContext namespaceContext,
XPathVariableResolver resolver
) {
XPathFactory factory = XPathFactory.newInstance();
XPath xpath = factory.newXPath();
if (namespaceContext != null) {
xpath.setNamespaceContext(namespaceContext);
}
if (resolver != null) {
xpath.setXPathVariableResolver(resolver);
}
return xpath;
}
java类javax.xml.xpath.XPathVariableResolver的实例源码
XML.java 文件源码
项目:downloadclient
阅读 28
收藏 0
点赞 0
评论 0
XPathScheme.java 文件源码
项目:kc-rice
阅读 22
收藏 0
点赞 0
评论 0
public Object load(Property property, final RouteContext context) {
XPath xpath = XPathHelper.newXPath();
final BranchService branchService = KEWServiceLocator.getBranchService();
xpath.setXPathVariableResolver(new XPathVariableResolver() {
public Object resolveVariable(QName name) {
LOG.debug("Resolving XPath variable: " + name);
String value = branchService.getScopedVariableValue(context.getNodeInstance().getBranch(), BranchState.VARIABLE_PREFIX + name.getLocalPart());
LOG.debug("Resolved XPath variable " + name + " to " + value);
return value;
}
});
try {
String docContent = context.getDocument().getDocContent();
LOG.debug("Executing xpath expression '" + property.locator + "' in doc '" + docContent + "'");
return xpath.evaluate(property.locator, new InputSource(new StringReader(docContent)), XPathConstants.STRING);
} catch (XPathExpressionException xpee) {
throw new RuntimeException("Error evaluating xpath expression '" + property.locator + "'", xpee);
}
}
XPathHelper.java 文件源码
项目:ph-commons
阅读 28
收藏 0
点赞 0
评论 0
/**
* Create a new {@link XPath} with the passed variable resolver, function
* resolver and namespace context.
*
* @param aXPathFactory
* The XPath factory object to use. May not be <code>null</code>.
* @param aVariableResolver
* Variable resolver to be used. May be <code>null</code>.
* @param aFunctionResolver
* Function resolver to be used. May be <code>null</code>.
* @param aNamespaceContext
* Namespace context to be used. May be <code>null</code>.
* @return The created non-<code>null</code> {@link XPath} object
*/
@Nonnull
public static XPath createNewXPath (@Nonnull final XPathFactory aXPathFactory,
@Nullable final XPathVariableResolver aVariableResolver,
@Nullable final XPathFunctionResolver aFunctionResolver,
@Nullable final NamespaceContext aNamespaceContext)
{
ValueEnforcer.notNull (aXPathFactory, "XPathFactory");
final XPath aXPath = aXPathFactory.newXPath ();
if (aVariableResolver != null)
aXPath.setXPathVariableResolver (aVariableResolver);
if (aFunctionResolver != null)
aXPath.setXPathFunctionResolver (aFunctionResolver);
if (aNamespaceContext != null)
aXPath.setNamespaceContext (aNamespaceContext);
return aXPath;
}
PSBoundSchemaCacheKey.java 文件源码
项目:ph-schematron
阅读 22
收藏 0
点赞 0
评论 0
public PSBoundSchemaCacheKey (@Nonnull final IReadableResource aResource,
@Nullable final String sPhase,
@Nullable final IPSErrorHandler aErrorHandler,
@Nullable final XPathVariableResolver aVariableResolver,
@Nullable final XPathFunctionResolver aFunctionResolver,
@Nullable final EntityResolver aEntityResolver)
{
ValueEnforcer.notNull (aResource, "Resource");
m_aResource = aResource;
m_sPhase = sPhase;
m_aErrorHandler = aErrorHandler;
m_aVariableResolver = aVariableResolver;
m_aFunctionResolver = aFunctionResolver;
m_aEntityResolver = aEntityResolver;
}
XPathScheme.java 文件源码
项目:rice
阅读 20
收藏 0
点赞 0
评论 0
public Object load(Property property, final RouteContext context) {
XPath xpath = XPathHelper.newXPath();
final BranchService branchService = KEWServiceLocator.getBranchService();
xpath.setXPathVariableResolver(new XPathVariableResolver() {
public Object resolveVariable(QName name) {
LOG.debug("Resolving XPath variable: " + name);
String value = branchService.getScopedVariableValue(context.getNodeInstance().getBranch(), BranchState.VARIABLE_PREFIX + name.getLocalPart());
LOG.debug("Resolved XPath variable " + name + " to " + value);
return value;
}
});
try {
String docContent = context.getDocument().getDocContent();
LOG.debug("Executing xpath expression '" + property.locator + "' in doc '" + docContent + "'");
return xpath.evaluate(property.locator, new InputSource(new StringReader(docContent)), XPathConstants.STRING);
} catch (XPathExpressionException xpee) {
throw new RuntimeException("Error evaluating xpath expression '" + property.locator + "'", xpee);
}
}
XPathEvaluator.java 文件源码
项目:lolxml-common
阅读 22
收藏 0
点赞 0
评论 0
public void init(Node ctx, final Map<String, Object> properties,
final ReferenceResolver referenceResolver){
XPathFactory factory = XPathFactory.newInstance();
xpath = factory.newXPath();
xpath.setXPathVariableResolver(new XPathVariableResolver(){
@Override
public Object resolveVariable(QName variableName) {
return properties.get(variableName.getLocalPart());
}
});
xpath.setXPathFunctionResolver(new XPathFunctionResolver(){
@Override
public XPathFunction resolveFunction(QName name, int arity) {
if (FUNC_RANDOM.equals(name.getLocalPart())){
return new XPathFunctionRandom();
}
if (FUNC_EVALUATE.equals(name.getLocalPart())){
return new XPathFunctionEvaluate(referenceResolver);
}
return null;
}
});
this.ctx=ctx;
}
XPathScheme.java 文件源码
项目:kuali_rice
阅读 18
收藏 0
点赞 0
评论 0
public Object load(Property property, final RouteContext context) {
XPath xpath = XPathHelper.newXPath();
final BranchService branchService = KEWServiceLocator.getBranchService();
xpath.setXPathVariableResolver(new XPathVariableResolver() {
public Object resolveVariable(QName name) {
LOG.debug("Resolving XPath variable: " + name);
String value = branchService.getScopedVariableValue(context.getNodeInstance().getBranch(), BranchState.VARIABLE_PREFIX + name.getLocalPart());
LOG.debug("Resolved XPath variable " + name + " to " + value);
return value;
}
});
try {
String docContent = context.getDocument().getDocContent();
LOG.debug("Executing xpath expression '" + property.locator + "' in doc '" + docContent + "'");
return xpath.evaluate(property.locator, new InputSource(new StringReader(docContent)), XPathConstants.STRING);
} catch (XPathExpressionException xpee) {
throw new RuntimeException("Error evaluating xpath expression '" + property.locator + "'", xpee);
}
}
XPathImpl.java 文件源码
项目:OpenJSharp
阅读 23
收藏 0
点赞 0
评论 0
XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr,
boolean featureSecureProcessing, boolean useServiceMechanism,
FeatureManager featureManager) {
this.origVariableResolver = this.variableResolver = vr;
this.origFunctionResolver = this.functionResolver = fr;
this.featureSecureProcessing = featureSecureProcessing;
this.useServiceMechanism = useServiceMechanism;
this.featureManager = featureManager;
}
XPathImpl.java 文件源码
项目:OpenJSharp
阅读 29
收藏 0
点赞 0
评论 0
/**
* <p>Establishes a variable resolver.</p>
*
* @param resolver Variable Resolver
*/
public void setXPathVariableResolver(XPathVariableResolver resolver) {
if ( resolver == null ) {
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
new Object[] {"XPathVariableResolver"} );
throw new NullPointerException( fmsg );
}
this.variableResolver = resolver;
}
XPathExpressionImpl.java 文件源码
项目:OpenJSharp
阅读 24
收藏 0
点赞 0
评论 0
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
JAXPPrefixResolver prefixResolver,
XPathFunctionResolver functionResolver,
XPathVariableResolver variableResolver ) {
this(xpath, prefixResolver, functionResolver, variableResolver,
false, true, new FeatureManager());
}
XPathExpressionImpl.java 文件源码
项目:OpenJSharp
阅读 27
收藏 0
点赞 0
评论 0
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
JAXPPrefixResolver prefixResolver,XPathFunctionResolver functionResolver,
XPathVariableResolver variableResolver, boolean featureSecureProcessing,
boolean useServicesMechanism, FeatureManager featureManager ) {
this.xpath = xpath;
this.prefixResolver = prefixResolver;
this.functionResolver = functionResolver;
this.variableResolver = variableResolver;
this.featureSecureProcessing = featureSecureProcessing;
this.useServicesMechanism = useServicesMechanism;
this.featureManager = featureManager;
}
XPathImpl.java 文件源码
项目:openjdk-jdk10
阅读 24
收藏 0
点赞 0
评论 0
XPathImpl(XPathVariableResolver vr, XPathFunctionResolver fr,
boolean featureSecureProcessing, boolean useServiceMechanism,
JdkXmlFeatures featureManager) {
this.origVariableResolver = this.variableResolver = vr;
this.origFunctionResolver = this.functionResolver = fr;
this.featureSecureProcessing = featureSecureProcessing;
this.useServiceMechanism = useServiceMechanism;
this.featureManager = featureManager;
}
XPathExpressionImpl.java 文件源码
项目:openjdk-jdk10
阅读 27
收藏 0
点赞 0
评论 0
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
JAXPPrefixResolver prefixResolver,
XPathFunctionResolver functionResolver,
XPathVariableResolver variableResolver) {
this(xpath, prefixResolver, functionResolver, variableResolver,
false, true, new JdkXmlFeatures(false));
}
XPathExpressionImpl.java 文件源码
项目:openjdk-jdk10
阅读 24
收藏 0
点赞 0
评论 0
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
JAXPPrefixResolver prefixResolver,XPathFunctionResolver functionResolver,
XPathVariableResolver variableResolver, boolean featureSecureProcessing,
boolean useServiceMechanism, JdkXmlFeatures featureManager) {
this.xpath = xpath;
this.prefixResolver = prefixResolver;
this.functionResolver = functionResolver;
this.variableResolver = variableResolver;
this.featureSecureProcessing = featureSecureProcessing;
this.useServiceMechanism = useServiceMechanism;
this.featureManager = featureManager;
}
XPathImpl.java 文件源码
项目:openjdk9
阅读 28
收藏 0
点赞 0
评论 0
XPathImpl(XPathVariableResolver vr, XPathFunctionResolver fr,
boolean featureSecureProcessing, boolean useServiceMechanism,
FeatureManager featureManager) {
this.origVariableResolver = this.variableResolver = vr;
this.origFunctionResolver = this.functionResolver = fr;
this.featureSecureProcessing = featureSecureProcessing;
this.useServiceMechanism = useServiceMechanism;
this.featureManager = featureManager;
}
XPathExpressionImpl.java 文件源码
项目:openjdk9
阅读 29
收藏 0
点赞 0
评论 0
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
JAXPPrefixResolver prefixResolver,
XPathFunctionResolver functionResolver,
XPathVariableResolver variableResolver) {
this(xpath, prefixResolver, functionResolver, variableResolver,
false, true, new FeatureManager());
}
XPathExpressionImpl.java 文件源码
项目:openjdk9
阅读 52
收藏 0
点赞 0
评论 0
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
JAXPPrefixResolver prefixResolver,XPathFunctionResolver functionResolver,
XPathVariableResolver variableResolver, boolean featureSecureProcessing,
boolean useServiceMechanism, FeatureManager featureManager) {
this.xpath = xpath;
this.prefixResolver = prefixResolver;
this.functionResolver = functionResolver;
this.variableResolver = variableResolver;
this.featureSecureProcessing = featureSecureProcessing;
this.useServiceMechanism = useServiceMechanism;
this.featureManager = featureManager;
}
XPathImpl.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 27
收藏 0
点赞 0
评论 0
XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr,
boolean featureSecureProcessing, boolean useServiceMechanism,
FeatureManager featureManager) {
this.origVariableResolver = this.variableResolver = vr;
this.origFunctionResolver = this.functionResolver = fr;
this.featureSecureProcessing = featureSecureProcessing;
this.useServiceMechanism = useServiceMechanism;
this.featureManager = featureManager;
}
XPathImpl.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 43
收藏 0
点赞 0
评论 0
/**
* <p>Establishes a variable resolver.</p>
*
* @param resolver Variable Resolver
*/
public void setXPathVariableResolver(XPathVariableResolver resolver) {
if ( resolver == null ) {
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
new Object[] {"XPathVariableResolver"} );
throw new NullPointerException( fmsg );
}
this.variableResolver = resolver;
}
XPathExpressionImpl.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 27
收藏 0
点赞 0
评论 0
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
JAXPPrefixResolver prefixResolver,
XPathFunctionResolver functionResolver,
XPathVariableResolver variableResolver ) {
this(xpath, prefixResolver, functionResolver, variableResolver,
false, true, new FeatureManager());
}
XPathExpressionImpl.java 文件源码
项目:lookaside_java-1.8.0-openjdk
阅读 28
收藏 0
点赞 0
评论 0
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
JAXPPrefixResolver prefixResolver,XPathFunctionResolver functionResolver,
XPathVariableResolver variableResolver, boolean featureSecureProcessing,
boolean useServicesMechanism, FeatureManager featureManager ) {
this.xpath = xpath;
this.prefixResolver = prefixResolver;
this.functionResolver = functionResolver;
this.variableResolver = variableResolver;
this.featureSecureProcessing = featureSecureProcessing;
this.useServicesMechanism = useServicesMechanism;
this.featureManager = featureManager;
}
XPathImpl.java 文件源码
项目:javify
阅读 26
收藏 0
点赞 0
评论 0
XPathImpl(NamespaceContext namespaceContext,
XPathVariableResolver variableResolver,
XPathFunctionResolver functionResolver)
{
parser = new XPathParser();
this.namespaceContext = namespaceContext;
this.variableResolver = variableResolver;
this.functionResolver = functionResolver;
reset();
}
XPathImpl.java 文件源码
项目:jvm-stm
阅读 22
收藏 0
点赞 0
评论 0
XPathImpl(NamespaceContext namespaceContext,
XPathVariableResolver variableResolver,
XPathFunctionResolver functionResolver)
{
parser = new XPathParser();
this.namespaceContext = namespaceContext;
this.variableResolver = variableResolver;
this.functionResolver = functionResolver;
reset();
}
XPathImpl.java 文件源码
项目:infobip-open-jdk-8
阅读 23
收藏 0
点赞 0
评论 0
XPathImpl( XPathVariableResolver vr, XPathFunctionResolver fr,
boolean featureSecureProcessing, boolean useServiceMechanism,
FeatureManager featureManager) {
this.origVariableResolver = this.variableResolver = vr;
this.origFunctionResolver = this.functionResolver = fr;
this.featureSecureProcessing = featureSecureProcessing;
this.useServiceMechanism = useServiceMechanism;
this.featureManager = featureManager;
}
XPathImpl.java 文件源码
项目:infobip-open-jdk-8
阅读 24
收藏 0
点赞 0
评论 0
/**
* <p>Establishes a variable resolver.</p>
*
* @param resolver Variable Resolver
*/
public void setXPathVariableResolver(XPathVariableResolver resolver) {
if ( resolver == null ) {
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
new Object[] {"XPathVariableResolver"} );
throw new NullPointerException( fmsg );
}
this.variableResolver = resolver;
}
XPathExpressionImpl.java 文件源码
项目:infobip-open-jdk-8
阅读 28
收藏 0
点赞 0
评论 0
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
JAXPPrefixResolver prefixResolver,
XPathFunctionResolver functionResolver,
XPathVariableResolver variableResolver ) {
this(xpath, prefixResolver, functionResolver, variableResolver,
false, true, new FeatureManager());
}
XPathExpressionImpl.java 文件源码
项目:infobip-open-jdk-8
阅读 28
收藏 0
点赞 0
评论 0
protected XPathExpressionImpl(com.sun.org.apache.xpath.internal.XPath xpath,
JAXPPrefixResolver prefixResolver,XPathFunctionResolver functionResolver,
XPathVariableResolver variableResolver, boolean featureSecureProcessing,
boolean useServicesMechanism, FeatureManager featureManager ) {
this.xpath = xpath;
this.prefixResolver = prefixResolver;
this.functionResolver = functionResolver;
this.variableResolver = variableResolver;
this.featureSecureProcessing = featureSecureProcessing;
this.useServicesMechanism = useServicesMechanism;
this.featureManager = featureManager;
}
XPathImpl.java 文件源码
项目:In-the-Box-Fork
阅读 25
收藏 0
点赞 0
评论 0
/**
* <p>Establishes a variable resolver.</p>
*
* @param resolver Variable Resolver
*/
public void setXPathVariableResolver(XPathVariableResolver resolver) {
if ( resolver == null ) {
String fmsg = XSLMessages.createXPATHMessage(
XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
new Object[] {"XPathVariableResolver"} );
throw new NullPointerException( fmsg );
}
this.variableResolver = resolver;
}
XPathExpressionImpl.java 文件源码
项目:In-the-Box-Fork
阅读 27
收藏 0
点赞 0
评论 0
protected XPathExpressionImpl(org.apache.xpath.XPath xpath,
JAXPPrefixResolver prefixResolver,
XPathFunctionResolver functionResolver,
XPathVariableResolver variableResolver ) {
this.xpath = xpath;
this.prefixResolver = prefixResolver;
this.functionResolver = functionResolver;
this.variableResolver = variableResolver;
this.featureSecureProcessing = false;
}
XPathExpressionImpl.java 文件源码
项目:In-the-Box-Fork
阅读 23
收藏 0
点赞 0
评论 0
protected XPathExpressionImpl(org.apache.xpath.XPath xpath,
JAXPPrefixResolver prefixResolver,
XPathFunctionResolver functionResolver,
XPathVariableResolver variableResolver,
boolean featureSecureProcessing ) {
this.xpath = xpath;
this.prefixResolver = prefixResolver;
this.functionResolver = functionResolver;
this.variableResolver = variableResolver;
this.featureSecureProcessing = featureSecureProcessing;
}