javax.xml.xpath.XPathFunction#javax.xml.xpath.XPathFunctionException源码实例Demo

下面列出了javax.xml.xpath.XPathFunction#javax.xml.xpath.XPathFunctionException 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: windup   文件: XmlFileFunctionResolver.java
@Override
public XPathFunction resolveFunction(final QName functionName, final int arity)
{
    if (functionMap.containsKey(functionName))
    {
        return new XPathFunction()
        {
            @Override
            public Object evaluate(List args) throws XPathFunctionException
            {
                return functionMap.get(functionName).evaluate(args);
            }
        };
    }
    return originalResolver.resolveFunction(functionName, arity);
}
 
源代码2 项目: jlibs   文件: TestFunctionResolver.java
@Override
public Object evaluate(List args) throws XPathFunctionException{
    char[] ch = ((String)args.get(0)).toCharArray();
    for(int i=0, j=ch.length-1; i<j; i++, j--){
        char temp = ch[i];
        ch[i] = ch[j];
        ch[j] = temp;
    }
    return new String(ch);
}
 
源代码3 项目: jlibs   文件: Functions.java
@Override
public Object evaluate(Object... args){
    try{
        return xpathFunction.evaluate(Arrays.asList(args));
    }catch(XPathFunctionException ex){
        throw new RuntimeException(ex);
    }
}
 
@Nullable
public Object evaluate (final List aArgs) throws XPathFunctionException
{
  try
  {
    // Convert the parameters
    final Sequence [] aSequences = new Sequence [aArgs.size ()];
    if (aArgs.size () > 0)
    {
      // Create a new context per evaluation
      final XPathContextMajor aXPathContext = m_aXQController.newXPathContext ();

      int nIndex = 0;
      for (final Object aArg : aArgs)
      {
        // Ripped from Saxon itself; genericType is not needed
        final JPConverter aConverter = JPConverter.allocate (aArg.getClass (), null, m_aConfiguration);
        // Convert to Sequence
        aSequences[nIndex] = aConverter.convert (aArg, aXPathContext);
        ++nIndex;
      }
    }
    // Finally invoke user function
    return m_aUserFunc.call (aSequences, m_aXQController);
  }
  catch (final Exception ex)
  {
    // Wrap all exceptions
    throw new XPathFunctionException (ex);
  }
}
 
源代码5 项目: rice   文件: XStreamSafeSearchFunction.java
public Object evaluate(List parameters) throws XPathFunctionException {
	String xPathExpression = getXPathExpressionParameter(parameters);
	evaluator.setXpath(xpath);
	//Node rootSearchNode = getRootSearchNodeParameter(parameters);
	try {
		return evaluator.evaluate(xPathExpression, rootNode);
	} catch (XPathExpressionException e) {
		throw new XPathFunctionException(e);
	}
}
 
源代码6 项目: rice   文件: XStreamSafeSearchFunction.java
private String getXPathExpressionParameter(List parameters) throws XPathFunctionException {
	if (parameters.size() < 1) {
		throw new XPathFunctionException("First parameter must be an XPath expression.");
	}
	if (!(parameters.get(0) instanceof String)) {
		throw new XPathFunctionException("First parameter must be an XPath expression String");
	}
	return (String)parameters.get(0);
}
 
源代码7 项目: windup   文件: XmlFileEvaluateXPathFunction.java
@Override
public Object evaluate(@SuppressWarnings("rawtypes") List args) throws XPathFunctionException
{
    int frameIdx = ((Double) args.get(0)).intValue();
    boolean expressionResult = (Boolean) args.get(1);
    LOG.fine("evaluate(" + frameIdx + ", " + expressionResult + ")");
    return expressionResult;
}
 
源代码8 项目: windup   文件: XmlFileStartFrameXPathFunction.java
@Override
public Object evaluate(@SuppressWarnings("rawtypes") List args) throws XPathFunctionException
{
    int frameIdx = ((Double) args.get(0)).intValue();
    LOG.fine("startFrame(" + frameIdx + ")!");
    paramMatchCache.addFrame(frameIdx);
    return true;
}
 
源代码9 项目: rice   文件: UpperCaseFunction.java
public Object evaluate(List parameters) throws XPathFunctionException {
	String parameter = parameters.get(0).toString();
	return parameter.toUpperCase();
}
 
源代码10 项目: windup   文件: XmlFileXpathValidator.java
@Override
public Object evaluate(@SuppressWarnings("rawtypes") List args) throws XPathFunctionException
{
    int frameIdx = ((Double) args.get(0)).intValue();
    NodeList arg1 = (NodeList) args.get(1);
    String nodeText = XmlUtil.nodeListToString(arg1);
    LOG.fine("persist(" + frameIdx + ", " + nodeText + ")");

    for (int i = 0; i < arg1.getLength(); i++)
    {
        Node node = arg1.item(i);
        if (xpathResultMatch != null)
        {
            if (!node.toString().matches(xpathResultMatch))
            {
                continue;
            }
        }
        // Everything passed for this Node. Start creating XmlTypeReferenceModel for it.
        int lineNumber = (int) node.getUserData(
                    LocationAwareContentHandler.LINE_NUMBER_KEY_NAME);
        int columnNumber = (int) node.getUserData(
                    LocationAwareContentHandler.COLUMN_NUMBER_KEY_NAME);

        GraphService<XmlTypeReferenceModel> fileLocationService = new GraphService<>(
                    event.getGraphContext(),
                    XmlTypeReferenceModel.class);
        XmlTypeReferenceModel fileLocation = fileLocationService.create();
        String sourceSnippit = XmlUtil.nodeToString(node);
        fileLocation.setSourceSnippit(sourceSnippit);
        fileLocation.setLineNumber(lineNumber);
        fileLocation.setColumnNumber(columnNumber);
        fileLocation.setLength(node.toString().length());
        fileLocation.setFile(xml);
        fileLocation.setXpath(xpathString);
        GraphService<NamespaceMetaModel> metaModelService = new GraphService<>(
                    event.getGraphContext(),
                    NamespaceMetaModel.class);
        for (Map.Entry<String, String> namespace : namespaces.entrySet())
        {
            NamespaceMetaModel metaModel = metaModelService.create();
            metaModel.setSchemaLocation(namespace.getKey());
            metaModel.setSchemaLocation(namespace.getValue());
            metaModel.addXmlResource(xml);
            fileLocation.addNamespace(metaModel);
        }
        resultLocations.add(fileLocation);

        evaluationStrategy.modelSubmissionRejected();
        evaluationStrategy.modelMatched();

        if (fileNameValidator.getFileNamePattern() != null && !fileNameValidator.getFileNamePattern().parse(xml.getFileName()).submit(event, context))
        {
            evaluationStrategy.modelSubmissionRejected();
            continue;
        }

        for (Map.Entry<String, String> entry : paramMatchCache.getVariables().entrySet())
        {
            Parameter<?> param = store.get(entry.getKey());
            String value = entry.getValue();
            if (!evaluationStrategy.submitValue(param, value))
            {
                evaluationStrategy.modelSubmissionRejected();
                return false;
            }
        }
        evaluationStrategy.modelSubmitted(fileLocation);
        evaluationStrategy.modelMatched();
    }

    return true;
}
 
源代码11 项目: dragonwell8_jdk   文件: XPathExFuncTest.java
public Object evaluate(List list) throws XPathFunctionException {

            return "Hello World";
        }
 
源代码12 项目: TencentKona-8   文件: XPathExFuncTest.java
public Object evaluate(List list) throws XPathFunctionException {

            return "Hello World";
        }
 
源代码13 项目: jdk8u60   文件: XPathExFuncTest.java
public Object evaluate(List list) throws XPathFunctionException {

            return "Hello World";
        }
 
源代码14 项目: openjdk-jdk8u   文件: XPathExFuncTest.java
public Object evaluate(List list) throws XPathFunctionException {

            return "Hello World";
        }
 
源代码15 项目: openjdk-jdk8u-backup   文件: XPathExFuncTest.java
public Object evaluate(List list) throws XPathFunctionException {

            return "Hello World";
        }
 
源代码16 项目: openjdk-jdk9   文件: XPathExFuncTest.java
public Object evaluate(List list) throws XPathFunctionException {

            return "Hello World";
        }
 
源代码17 项目: openjdk-jdk9   文件: SecureProcessingTest.java
public Object evaluate(List list) throws XPathFunctionException {

            return "Hello World";
        }
 
源代码18 项目: jdk8u-jdk   文件: XPathExFuncTest.java
public Object evaluate(List list) throws XPathFunctionException {

            return "Hello World";
        }
 
源代码19 项目: hottub   文件: XPathExFuncTest.java
public Object evaluate(List list) throws XPathFunctionException {

            return "Hello World";
        }
 
源代码20 项目: openjdk-8-source   文件: XPathExFuncTest.java
public Object evaluate(List list) throws XPathFunctionException {

            return "Hello World";
        }
 
源代码21 项目: openjdk-8   文件: XPathExFuncTest.java
public Object evaluate(List list) throws XPathFunctionException {

            return "Hello World";
        }
 
源代码22 项目: jdk8u_jdk   文件: XPathExFuncTest.java
public Object evaluate(List list) throws XPathFunctionException {

            return "Hello World";
        }
 
源代码23 项目: jdk8u-jdk   文件: XPathExFuncTest.java
public Object evaluate(List list) throws XPathFunctionException {

            return "Hello World";
        }
 
源代码24 项目: jdk8u-dev-jdk   文件: XPathExFuncTest.java
public Object evaluate(List list) throws XPathFunctionException {

            return "Hello World";
        }