Examples of XPathSelector


Examples of net.sf.saxon.s9api.XPathSelector

  private Map<ASTNode, String> findMatches(String xmlDoc, Pattern description,
      XmlVisitor visitor, XdmNode sourceDoc, XPathCompiler xpath)
      throws SaxonApiException {
    Map<ASTNode, String> result = new HashMap<ASTNode, String>();
    String expression = description.xpath;
    XPathSelector selector = compileExpr(xpath, expression);
    selector.setContextItem(sourceDoc);
    XPathSelector outputBeforeSelector = null;
    if (description.outputBefore != null) {
      outputBeforeSelector = outputXPathCompiler.compile(description.outputBefore).load();
    }

    for (XdmItem item : selector) {
      String valueToInsertBefore = null;
      ASTNode node = Utils.getMappedAstNode(visitor, item);
      if (node == null)
        throw new RuntimeException("Found node is not in AST: " + item);
      if (outputBeforeSelector != null) {
        outputBeforeSelector.setContextItem(item);
        outputBeforeSelector.setVariable(CONTEXT_VARIABLE, item);
        valueToInsertBefore = outputBeforeSelector.evaluate().toString();
      }
      result.put(node, valueToInsertBefore);
    }

    return result;
View Full Code Here

Examples of org.apache.abdera.ext.features.XPathSelector

        collections = FeaturesHelper.select(service, s2);

        assertEquals(1, collections.length);
        assertEquals(collections[0], collection2);

        Selector s3 = new XPathSelector("f:features/f:feature[@ref='" + FeaturesHelper.FEATURE_SUPPORTS_DRAFTS + "']");

        collections = FeaturesHelper.select(service, s3);

        assertEquals(1, collections.length);
        assertEquals(collections[0], collection1);
View Full Code Here

Examples of org.apache.abdera.ext.features.XPathSelector

    collections = FeaturesHelper.select(service,s2);
   
    assertEquals(1,collections.length);
    assertEquals(collections[0],collection2);
   
    Selector s3 = new XPathSelector(
      "f:features/f:feature[@ref='" + FeaturesHelper.FEATURE_SUPPORTS_DRAFTS + "']");
   
    collections = FeaturesHelper.select(service,s3);
   
    assertEquals(1,collections.length);
View Full Code Here

Examples of org.apache.abdera.ext.features.XPathSelector

    collections = FeaturesHelper.select(service,s2);
   
    assertEquals(1,collections.length);
    assertEquals(collections[0],collection2);
   
    Selector s3 = new XPathSelector(
      "f:feature[@ref='http://www.w3.org/2007/app/drafts']");
   
    collections = FeaturesHelper.select(service,s3);
   
    assertEquals(1,collections.length);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.