Package jodd.lagarto.dom

Examples of jodd.lagarto.dom.LagartoDOMBuilder


        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++) {
View Full Code Here


        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++) {
View Full Code Here

  public static class JerryParser {

    protected final DOMBuilder domBuilder;

    public JerryParser() {
      this.domBuilder = new LagartoDOMBuilder();
    }
View Full Code Here

        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++) {
View Full Code Here

  @Test
  public void testNonQuotedAttributeValue() {
    String html = "<a href=123>xxx</a>";

    LagartoDOMBuilder lagartoDOMBuilder = new LagartoDOMBuilder();
    lagartoDOMBuilder.getConfig().setCalculatePosition(true);
    Document document = lagartoDOMBuilder.parse(html);

    assertEquals("<a href=\"123\">xxx</a>", document.getHtml());
    assertTrue(document.check());

    html = "<a href=../org/w3c/dom/'http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-list'>xxx</a>";

    lagartoDOMBuilder = new LagartoDOMBuilder();
    lagartoDOMBuilder.getConfig().setCalculatePosition(true);
    document = lagartoDOMBuilder.parse(html);
    assertTrue(document.check());

    assertEquals("<a href=\"../org/w3c/dom/'http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-list'\">xxx</a>", document.getHtml());
  }
View Full Code Here

  @Test
  public void testIssue23_0() throws IOException {
    File file = new File(testDataRoot, "index-4-v0.html");

    LagartoDOMBuilder lagartoDOMBuilder = new LagartoDOMBuilder();
    lagartoDOMBuilder.getConfig().setCalculatePosition(true);
    lagartoDOMBuilder.getConfig().setCollectErrors(true);
    Document doc = lagartoDOMBuilder.parse(FileUtil.readString(file));
    assertTrue(doc.check());

    assertEquals(1, doc.getErrors().size());
  }
View Full Code Here

  @Test
  public void testIssue23_1() throws IOException {
    File file = new File(testDataRoot, "index-4-v1.html");

    LagartoDOMBuilder lagartoDOMBuilder = new LagartoDOMBuilder();
    lagartoDOMBuilder.getConfig().setCalculatePosition(true);
    lagartoDOMBuilder.getConfig().setCollectErrors(true);
    Document doc = lagartoDOMBuilder.parse(FileUtil.readString(file));
    assertTrue(doc.check());

    assertEquals(1, doc.getErrors().size());
  }
View Full Code Here

  @Test
  public void testIssue23() throws IOException {
    File file = new File(testDataRoot, "index-4.html");

    LagartoDOMBuilder lagartoDOMBuilder = new LagartoDOMBuilder();
    lagartoDOMBuilder.getConfig().setCalculatePosition(true);
    lagartoDOMBuilder.getConfig().setCollectErrors(true);
    Document document = lagartoDOMBuilder.parse(FileUtil.readString(file));
    assertTrue(document.check());

    // (1564 open DTs + 1564 open DDs) 1 open P
    assertEquals(19, document.getErrors().size());
View Full Code Here

  @Test
  public void testNamespaces() throws IOException {
    File file = new File(testDataRoot, "namespace.xml");

    LagartoDOMBuilder lagartoDOMBuilder = new LagartoDOMBuilder();
    lagartoDOMBuilder.enableXmlMode();
    lagartoDOMBuilder.getConfig().setCalculatePosition(true);

    Document doc = lagartoDOMBuilder.parse(FileUtil.readString(file));
    assertTrue(doc.check());

    Element cfgTestElement = (Element) doc.getChild(1);

    assertEquals("cfg:test", cfgTestElement.getNodeName());
View Full Code Here

  public static class JerryParser {

    protected final DOMBuilder domBuilder;

    public JerryParser() {
      this.domBuilder = new LagartoDOMBuilder();
    }
View Full Code Here

TOP

Related Classes of jodd.lagarto.dom.LagartoDOMBuilder

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.