Tabnine Logo
NodeSelector.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
jodd.lagarto.dom.NodeSelector
constructor

Best Java code snippets using jodd.lagarto.dom.NodeSelector.<init> (Showing top 14 results out of 315)

origin: oblac/jodd

/**
 * Creates node selector.
 */
protected NodeSelector createNodeSelector(final Node node) {
  return new NodeSelector(node);
}
origin: oblac/jodd

  @Override
  public boolean match(final Node node, final List<List<CssSelector>> selectors) {
    List<Node> matchedNodes = new NodeSelector(node).select(selectors);
    return !matchedNodes.isEmpty();
  }
}
origin: oblac/jodd

  private NodeSelector createNodeFilter() throws IOException {
    File file = new File(testDataRoot, "one.html");
    String html = FileUtil.readString(file);
    return new NodeSelector(new LagartoDOMBuilder().parse(html));
  }
}
origin: oblac/jodd

@Test
void test250() {
  String html = "<html>\n" +
    "  <body>\n" +
    "    <a href=\"/go?to=foobar&index=null\" title=\"Choice 1\">link</a>\n" +
    "  </body>\n" +
    "</html>";
  LagartoDOMBuilder domBuilder = new LagartoDOMBuilder();
  NodeSelector nodeSelector = new NodeSelector(domBuilder.parse(html));
  List<Node> selectedNodes = nodeSelector.select("a[title='Choice 1']");
  System.out.println();
  assertEquals("/go?to=foobar&index=null", selectedNodes.get(0).getAttribute("href"));
}
origin: oblac/jodd

@Test
void testGroupOfSelectors() throws IOException {
  File file = new File(testDataRoot, "one.html");
  String htmlContent = FileUtil.readString(file);
  Document document = new LagartoDOMBuilder().parse(htmlContent);
  List<Node> nodes = new NodeSelector(document).select("em, b, b");
  assertEquals(9, nodes.size());
  assertTrue(document.check());
}

origin: oblac/jodd

@Test
void testClassWithTabs() throws IOException {
  File file = new File(testDataRoot, "class-tabs.html");
  String htmlContent = FileUtil.readString(file);
  Document document = new LagartoDOMBuilder().parse(htmlContent);
  List<Node> nodes = new NodeSelector(document).select(".hey");
  assertEquals(1, nodes.size());
  Node n = nodes.get(0);
  assertEquals("div", n.getNodeName());
  assertEquals("jodd", n.getAttribute("id"));
}
origin: oblac/jodd

@Test
void testTwoHtml() throws IOException {
  File file = new File(testDataRoot, "two.html");
  String htmlContent = FileUtil.readString(file);
  Document document = new LagartoDOMBuilder().parse(htmlContent);
  Node html = new NodeSelector(document).select("html").get(0);
  assertNotNull(html);
  Node body = new NodeSelector(html).selectFirst("body");
  Element h1 = body.getFirstChildElement();
  assertEquals("h1", h1.getNodeName());
  Node comment1 = body.getFirstChild().getNextSibling();
  assertEquals(Node.NodeType.COMMENT, comment1.getNodeType());
  Element p = (Element) new NodeSelector(body).selectFirst("p");
  assertEquals(h1, p.getPreviousSiblingElement());
  assertEquals(h1, comment1.getNextSiblingElement());
  assertNull(comment1.getNextSiblingName());
  // check if filter works just for sub elements
  List<Node> p_ems = new NodeSelector(p).select("em");
  assertEquals(1, p_ems.size());
  Element script = (Element) new NodeSelector(html).selectFirst("script");
  assertEquals("text/javascript", script.getAttribute("type"));
  assertTrue(document.check());
}
origin: oblac/jodd

NodeSelector nodeSelector = new NodeSelector(xml);
List<Node> persons = nodeSelector.select("person");
origin: oblac/jodd

document = new LagartoDOMBuilder().parse(html);
NodeSelector nodeSelector = new NodeSelector(document);
Element div = (Element) nodeSelector.selectFirst("div.ysites-col");
Element h2 = (Element) div.getFirstChild();
origin: fivesmallq/web-data-extractor

/**
 * Creates node selector.
 */
protected NodeSelector createNodeSelector(Node node) {
  return new NodeSelector(node);
}
origin: org.jodd/jodd-lagarto

/**
 * Creates node selector.
 */
protected NodeSelector createNodeSelector(final Node node) {
  return new NodeSelector(node);
}
origin: org.jodd/jodd-wot

/**
 * Creates node selector.
 */
protected NodeSelector createNodeSelector(Node node) {
  return new NodeSelector(node);
}
origin: org.jodd/jodd-lagarto

  @Override
  public boolean match(final Node node, final List<List<CssSelector>> selectors) {
    List<Node> matchedNodes = new NodeSelector(node).select(selectors);
    return !matchedNodes.isEmpty();
  }
}
origin: org.apache.jmeter/ApacheJMeter_components

  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);
LagartoDOMBuilder domBuilder = new LagartoDOMBuilder();
jodd.lagarto.dom.Document doc = domBuilder.parse(inputString);
nodeSelector = new NodeSelector(doc);
jodd.lagarto.domNodeSelector<init>

Popular methods of NodeSelector

  • select
    Selects nodes using NodeFilter.
  • filter
    Filter nodes.
  • selectAndAdd
    Selects single node for single selector and appends it to the results.
  • walk
  • walkDescendantsIteratively
    Walks over the child notes, maintaining the tree order and not using recursion.
  • processSelectors
    Process selectors and keep adding results.
  • createCSSelly
    Creates CSSelly instance for parsing files.
  • selectFirst
    Selects nodes using NodeFilter and return the very first one.

Popular in Java

  • Making http post requests using okhttp
  • getSystemService (Context)
  • requestLocationUpdates (LocationManager)
  • getSupportFragmentManager (FragmentActivity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now