Package jodd.lagarto.dom

Examples of jodd.lagarto.dom.NodeSelector


     */
    @Override
    public int extract(String expression, String attribute, int matchNumber,
            String inputString, List<String> result, int found,
            String cacheKey) {
        NodeSelector nodeSelector = null;
        if (cacheKey != null) {
            nodeSelector = (NodeSelector)
                    JMeterContextService.getContext().getSamplerContext().get(CACHE_KEY_PREFIX+cacheKey);
            if(nodeSelector==null) {
                LagartoDOMBuilder domBuilder = new LagartoDOMBuilder();
                jodd.lagarto.dom.Document doc = domBuilder.parse(inputString);
                nodeSelector = new NodeSelector(doc);
                JMeterContextService.getContext().getSamplerContext().put(CACHE_KEY_PREFIX+cacheKey, nodeSelector);
            }
        } else {
            LagartoDOMBuilder domBuilder = new LagartoDOMBuilder();
            jodd.lagarto.dom.Document doc = domBuilder.parse(inputString);
            nodeSelector = new NodeSelector(doc);
        }
        List<Node> elements = nodeSelector.select(expression);
        int size = elements.size();
        for (int i = 0; i < size; i++) {
            Node element = elements.get(i);
            if (matchNumber <=0 || found != matchNumber) {
                result.add(extractValue(attribute, element));
View Full Code Here


     */
    @Override
    public int extract(String expression, String attribute, int matchNumber,
            String inputString, List<String> result, int found,
            String cacheKey) {
        NodeSelector nodeSelector = null;
        if (cacheKey != null) {
            nodeSelector = (NodeSelector)
                    JMeterContextService.getContext().getSamplerContext().get(CACHE_KEY_PREFIX+cacheKey);
            if(nodeSelector==null) {
                LagartoDOMBuilder domBuilder = new LagartoDOMBuilder();
                jodd.lagarto.dom.Document doc = domBuilder.parse(inputString);
                nodeSelector = new NodeSelector(doc);
                JMeterContextService.getContext().getSamplerContext().put(CACHE_KEY_PREFIX+cacheKey, nodeSelector);
            }
        } else {
            LagartoDOMBuilder domBuilder = new LagartoDOMBuilder();
            jodd.lagarto.dom.Document doc = domBuilder.parse(inputString);
            nodeSelector = new NodeSelector(doc);
        }
        LinkedList<Node> elements = nodeSelector.select(expression);
        int size = elements.size();
        for (int i = 0; i < size; i++) {
            Node element = elements.get(i);
            if (matchNumber <=0 || found != matchNumber) {
                result.add(extractValue(attribute, element));
View Full Code Here

   */
  public Jerry find(String cssSelector) {
    final List<Node> result = new NodeList();

    for (Node node : nodes) {
      NodeSelector nodeSelector = createNodeSelector(node);
      List<Node> filteredNodes = nodeSelector.select(cssSelector);
      result.addAll(filteredNodes);
    }

    return new Jerry(this, result);
  }
View Full Code Here

  /**
   * Creates node selector.
   */
  protected NodeSelector createNodeSelector(Node node) {
    return new NodeSelector(node);
  }
View Full Code Here

      Node parentNode = node.getParentNode();
      if (parentNode == null) {
        continue;
      }

      NodeSelector nodeSelector = createNodeSelector(parentNode);
      List<Node> selectedNodes = nodeSelector.select(cssSelectors);

      for (Node selected : selectedNodes) {
        if (node == selected) {
          return true;
        }
View Full Code Here

      Node parentNode = node.getParentNode();
      if (parentNode == null) {
        continue;
      }

      NodeSelector nodeSelector = createNodeSelector(parentNode);
      List<Node> selectedNodes = nodeSelector.select(cssSelectors);

      for (Node selected : selectedNodes) {
        if (node == selected) {
          result.add(node);
        }
View Full Code Here

     */
    @Override
    public int extract(String expression, String attribute, int matchNumber,
            String inputString, List<String> result, int found,
            String cacheKey) {
        NodeSelector nodeSelector = null;
        if (cacheKey != null) {
            nodeSelector = (NodeSelector)
                    JMeterContextService.getContext().getSamplerContext().get(CACHE_KEY_PREFIX+cacheKey);
            if(nodeSelector==null) {
                LagartoDOMBuilder domBuilder = new LagartoDOMBuilder();
                jodd.lagarto.dom.Document doc = domBuilder.parse(inputString);
                nodeSelector = new NodeSelector(doc);
                JMeterContextService.getContext().getSamplerContext().put(CACHE_KEY_PREFIX+cacheKey, nodeSelector);
            }
        } else {
            LagartoDOMBuilder domBuilder = new LagartoDOMBuilder();
            jodd.lagarto.dom.Document doc = domBuilder.parse(inputString);
            nodeSelector = new NodeSelector(doc);
        }
        List<Node> elements = nodeSelector.select(expression);
        int size = elements.size();
        for (int i = 0; i < size; i++) {
            Node element = elements.get(i);
            if (matchNumber <=0 || found != matchNumber) {
                result.add(extractValue(attribute, element));
View Full Code Here

   */
  public Jerry find(String cssSelector) {
    final List<Node> result = new NodeList();

    for (Node node : nodes) {
      NodeSelector nodeSelector = createNodeSelector(node);
      List<Node> filteredNodes = nodeSelector.select(cssSelector);
      result.addAll(filteredNodes);
    }

    return new Jerry(this, result);
  }
View Full Code Here

  /**
   * Creates node selector.
   */
  protected NodeSelector createNodeSelector(Node node) {
    return new NodeSelector(node);
  }
View Full Code Here

      Node parentNode = node.getParentNode();
      if (parentNode == null) {
        continue;
      }

      NodeSelector nodeSelector = createNodeSelector(parentNode);
      List<Node> selectedNodes = nodeSelector.select(cssSelectors);

      for (Node selected : selectedNodes) {
        if (node == selected) {
          return true;
        }
View Full Code Here

TOP

Related Classes of jodd.lagarto.dom.NodeSelector

Copyright © 2018 www.massapicom. 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.