Package org.htmlparser

Examples of org.htmlparser.Node.toHtml()


                    final Snippet snippet = tags.size() == 0 ? null : tags.peek();
                    if (snippet instanceof HtmlSnippet) {
                        ((HtmlSnippet) snippet).append(node.toHtml());
                    } else {
                        final HtmlSnippet htmlSnippet = new HtmlSnippet(lineNumbers, filePath);
                        htmlSnippet.append(node.toHtml());
                        tags.push(htmlSnippet);
                    }
                }

            }
View Full Code Here


                        tags.addAll(tagsForPreviousTemplate);
                    }
                } else {
                    final Snippet snippet = tags.size() == 0 ? null : tags.peek();
                    if (snippet instanceof HtmlSnippet) {
                        ((HtmlSnippet) snippet).append(node.toHtml());
                    } else {
                        final HtmlSnippet htmlSnippet = new HtmlSnippet(lineNumbers, filePath);
                        htmlSnippet.append(node.toHtml());
                        tags.push(htmlSnippet);
                    }
View Full Code Here

                    final Snippet snippet = tags.size() == 0 ? null : tags.peek();
                    if (snippet instanceof HtmlSnippet) {
                        ((HtmlSnippet) snippet).append(node.toHtml());
                    } else {
                        final HtmlSnippet htmlSnippet = new HtmlSnippet(lineNumbers, filePath);
                        htmlSnippet.append(node.toHtml());
                        tags.push(htmlSnippet);
                    }
                }

            }
View Full Code Here

      Lexer lexer = new Lexer(html);
      Node node;
      StringBuilder sb = new StringBuilder(html.length());
      while ((node = lexer.nextNode()) != null) {
        if (node instanceof TextNode) {
          sb.append(node.toHtml());
        }
        if (sb.length() > len) {
          break;
        }
      }
View Full Code Here

      Lexer lexer = new Lexer(txt);
      Node node;
      StringBuilder sb = new StringBuilder((int) (txt.length() * 1.2));
      while ((node = lexer.nextNode()) != null) {
        if (node instanceof TextNode) {
          sb.append(StringUtils.replaceEach(node.toHtml(), searchArr,
              replacementArr));
        } else {
          sb.append(node.toHtml());
        }
      }
View Full Code Here

      while ((node = lexer.nextNode()) != null) {
        if (node instanceof TextNode) {
          sb.append(StringUtils.replaceEach(node.toHtml(), searchArr,
              replacementArr));
        } else {
          sb.append(node.toHtml());
        }
      }
      return sb.toString();
    } catch (ParserException e) {
      throw new RuntimeException(e);
View Full Code Here

        parseAndAssertNodeCount (1);
        assertStringEquals ("html wrong", html, node[0].toHtml ());
        assertTrue ("wrong number of children", 1 == node[0].getChildren ().size ());
        assertTrue ("string node expected", node[0].getChildren ().elementAt (0) instanceof Text);
        txt = node[0].getChildren ().elementAt (0);
        assertStringEquals ("string html wrong", text, txt.toHtml ());
        assertStringEquals ("string contents wrong", text, txt.getText ());
        assertTrue ("toString wrong", txt.toString ().endsWith (text));
        txt.setText (newtext);
        assertStringEquals ("html wrong", newhtml, node[0].toHtml ());
        assertStringEquals ("new string html wrong", newtext, txt.toHtml ());
View Full Code Here

        assertStringEquals ("string html wrong", text, txt.toHtml ());
        assertStringEquals ("string contents wrong", text, txt.getText ());
        assertTrue ("toString wrong", txt.toString ().endsWith (text));
        txt.setText (newtext);
        assertStringEquals ("html wrong", newhtml, node[0].toHtml ());
        assertStringEquals ("new string html wrong", newtext, txt.toHtml ());
        assertStringEquals ("new string contents wrong", newtext, txt.getText ());
        assertTrue ("toString wrong", txt.toString ().endsWith (newtext));
    }

    /**
 
View Full Code Here

        parseAndAssertNodeCount (1);
        assertStringEquals ("html wrong", html, node[0].toHtml ());
        assertTrue ("wrong number of children", 1 == node[0].getChildren ().size ());
        assertTrue ("remark node expected", node[0].getChildren ().elementAt (0) instanceof Remark);
        rem = node[0].getChildren ().elementAt (0);
        assertStringEquals ("remark html wrong", remark, rem.toHtml ());
        assertStringEquals ("remark contents wrong", text, rem.getText ());
        assertTrue ("toString wrong", rem.toString ().endsWith (text));
        rem.setText (newtext);
        assertStringEquals ("html wrong", newhtml, node[0].toHtml ());
        assertStringEquals ("new remark html wrong", newremark, rem.toHtml ());
View Full Code Here

        assertStringEquals ("remark html wrong", remark, rem.toHtml ());
        assertStringEquals ("remark contents wrong", text, rem.getText ());
        assertTrue ("toString wrong", rem.toString ().endsWith (text));
        rem.setText (newtext);
        assertStringEquals ("html wrong", newhtml, node[0].toHtml ());
        assertStringEquals ("new remark html wrong", newremark, rem.toHtml ());
        assertStringEquals ("new remark contents wrong", newtext, rem.getText ());
        assertTrue ("toString wrong", rem.toString ().endsWith (newtext));
        rem.setText (newremark);
        assertStringEquals ("html wrong", newhtml, node[0].toHtml ());
        assertStringEquals ("new remark html wrong", newremark, rem.toHtml ());
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.