当前位置: 首页>>代码示例>>Java>>正文


Java XPathVariableResolver类代码示例

本文整理汇总了Java中javax.xml.xpath.XPathVariableResolver的典型用法代码示例。如果您正苦于以下问题:Java XPathVariableResolver类的具体用法?Java XPathVariableResolver怎么用?Java XPathVariableResolver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XPathVariableResolver类属于javax.xml.xpath包,在下文中一共展示了XPathVariableResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

import javax.xml.xpath.XPathVariableResolver; //导入依赖的package包/类
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);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:XPathScheme.java

示例2: createNewXPath

import javax.xml.xpath.XPathVariableResolver; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:phax,项目名称:ph-commons,代码行数:32,代码来源:XPathHelper.java

示例3: PSBoundSchemaCacheKey

import javax.xml.xpath.XPathVariableResolver; //导入依赖的package包/类
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;
}
 
开发者ID:phax,项目名称:ph-schematron,代码行数:17,代码来源:PSBoundSchemaCacheKey.java

示例4: init

import javax.xml.xpath.XPathVariableResolver; //导入依赖的package包/类
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;
}
 
开发者ID:brtl-fhc,项目名称:lolxml-common,代码行数:26,代码来源:XPathEvaluator.java

示例5: XPathImpl

import javax.xml.xpath.XPathVariableResolver; //导入依赖的package包/类
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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:XPathImpl.java

示例6: setXPathVariableResolver

import javax.xml.xpath.XPathVariableResolver; //导入依赖的package包/类
/**
 * <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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:XPathImpl.java

示例7: XPathExpressionImpl

import javax.xml.xpath.XPathVariableResolver; //导入依赖的package包/类
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());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:XPathExpressionImpl.java

示例8: XPathImpl

import javax.xml.xpath.XPathVariableResolver; //导入依赖的package包/类
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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:XPathImpl.java

示例9: XPathExpressionImpl

import javax.xml.xpath.XPathVariableResolver; //导入依赖的package包/类
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));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:XPathExpressionImpl.java

示例10: XPathImpl

import javax.xml.xpath.XPathVariableResolver; //导入依赖的package包/类
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;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:10,代码来源:XPathImpl.java

示例11: XPathExpressionImpl

import javax.xml.xpath.XPathVariableResolver; //导入依赖的package包/类
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());
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:8,代码来源:XPathExpressionImpl.java

示例12: XPathImpl

import javax.xml.xpath.XPathVariableResolver; //导入依赖的package包/类
XPathImpl(NamespaceContext namespaceContext,
          XPathVariableResolver variableResolver,
          XPathFunctionResolver functionResolver)
{
  parser = new XPathParser();
  this.namespaceContext = namespaceContext;
  this.variableResolver = variableResolver;
  this.functionResolver = functionResolver;
  reset();
}
 
开发者ID:vilie,项目名称:javify,代码行数:11,代码来源:XPathImpl.java

示例13: newXPath

import javax.xml.xpath.XPathVariableResolver; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:gdi-by,项目名称:downloadclient,代码行数:24,代码来源:XML.java

示例14: setXPathVariableResolver

import javax.xml.xpath.XPathVariableResolver; //导入依赖的package包/类
/**
 * <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;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:15,代码来源:XPathImpl.java

示例15: XPathExpressionImpl

import javax.xml.xpath.XPathVariableResolver; //导入依赖的package包/类
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;
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:11,代码来源:XPathExpressionImpl.java


注:本文中的javax.xml.xpath.XPathVariableResolver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。