Package org.htmlparser.beans

Examples of org.htmlparser.beans.StringBean


    /**
     * Test multiple whitespace returns empty string.
     */
    public void testCollapsed2 ()
    {
        StringBean sb;

        sb = new StringBean ();
        sb.setLinks (false);
        sb.setReplaceNonBreakingSpaces (true);
        sb.setCollapse (false);
        check (sb, "<html><head></head><body>  </body></html>", "  ");
        check (sb, "<html><head></head><body>\t\t</body></html>", "\t\t");
        check (sb, "<html><head></head><body> \t\t</body></html>", " \t\t");
        check (sb, "<html><head></head><body>\t \t</body></html>", "\t \t");
        check (sb, "<html><head></head><body>\t\t </body></html>", "\t\t ");
        sb.setCollapse (true);
        check (sb, "<html><head></head><body>  </body></html>", "");
        check (sb, "<html><head></head><body>\t\t</body></html>", "");
        check (sb, "<html><head></head><body> \t\t</body></html>", "");
        check (sb, "<html><head></head><body>\t \t</body></html>", "");
        check (sb, "<html><head></head><body>\t\t </body></html>", "");
View Full Code Here


    /**
     * Test text preceded or followed by whitespace returns just text.
     */
    public void testCollapsed3 ()
    {
        StringBean sb;

        sb = new StringBean ();
        sb.setLinks (false);
        sb.setReplaceNonBreakingSpaces (true);
        sb.setCollapse (false);
        check (sb, "<html><head></head><body>x  </body></html>", "x  ");
        check (sb, "<html><head></head><body>x\t\t</body></html>", "x\t\t");
        check (sb, "<html><head></head><body>x \t\t</body></html>", "x \t\t");
        check (sb, "<html><head></head><body>x\t \t</body></html>", "x\t \t");
        check (sb, "<html><head></head><body>x\t\t </body></html>", "x\t\t ");
        sb.setCollapse (true);
        check (sb, "<html><head></head><body>x  </body></html>", "x");
        check (sb, "<html><head></head><body>x\t\t</body></html>", "x");
        check (sb, "<html><head></head><body>x \t\t</body></html>", "x");
        check (sb, "<html><head></head><body>x\t \t</body></html>", "x");
        check (sb, "<html><head></head><body>x\t\t </body></html>", "x");
View Full Code Here

    /**
     * Test text including a "pre" tag
     */
    public void testOutputWithPreTags() {
        StringBean sb;
        sb = new StringBean ();
        String sampleCode = "public class Product {}";
        check (sb, "<body><pre>"+sampleCode+"</pre></body>", sampleCode);
    }
View Full Code Here

    /**
     * Test text including a "script" tag
     */
    public void testOutputWithScriptTags() {
        StringBean sb;
        sb = new StringBean ();

        String sampleScript =
          "<script language=\"javascript\">\r\n"
        + "if(navigator.appName.indexOf(\"Netscape\") != -1)\r\n"
        + " document.write ('xxx');\r\n"
View Full Code Here

    /*
     * Test output with pre and any tag.
     */
    public void testOutputWithPreAndAnyTag()
    {
        StringBean sb;

        sb = new StringBean ();
        sb.setLinks (false);
        sb.setReplaceNonBreakingSpaces (true);
        sb.setCollapse (false);
        check (sb, "<html><head></head><body><pre><hello></pre></body></html>", "");
    }
View Full Code Here

    /*
     * Test output with pre and any tag and text.
     */
    public void testOutputWithPreAndAnyTagPlusText()
    {
        StringBean sb;

        sb = new StringBean ();
        sb.setLinks (false);
        sb.setReplaceNonBreakingSpaces (true);
        sb.setCollapse (false);
        check (sb, "<html><head></head><body><pre><hello>dogfood</hello></pre></body></html>", "dogfood");
    }
View Full Code Here

    /*
     * Test output with pre and any tag and text.
     */
    public void testOutputWithPreAndAnyTagPlusTextWithWhitespace()
    {
        StringBean sb;

        sb = new StringBean ();
        sb.setLinks (false);
        sb.setReplaceNonBreakingSpaces (true);
        sb.setCollapse (true);
        check (sb, "<html><head></head><body><pre><hello>dog  food</hello></pre></body></html>", "dog  food");
    }
View Full Code Here

    /*
     * Test output without pre and any tag and text.
     */
    public void testOutputWithoutPreAndAnyTagPlusTextWithWhitespace()
    {
        StringBean sb;

        sb = new StringBean ();
        sb.setLinks (false);
        sb.setReplaceNonBreakingSpaces (true);
        sb.setCollapse (true);
        check (sb, "<html><head></head><body><hello>dog  food</hello></body></html>", "dog food");
    }
View Full Code Here

    /**
     * Test output with pre and script tags
     */
    public void xtestOutputWithPreAndScriptTags ()
    {
        StringBean sb;
        sb = new StringBean ();

        String sampleScript =
          "<script language=\"javascript\">\r\n"
        + "if(navigator.appName.indexOf(\"Netscape\") != -1)\r\n"
        + " document.write ('xxx');\r\n"
View Full Code Here

    /**
     * Test output with non-breaking tag within text.
     */
    public void testTagWhitespace ()
    {
        StringBean sb;
        sb = new StringBean ();

        String pre = "AAAAA BBBBB AAA";
        String mid = "AA";
        String post = " BBBBB";
        String html =
View Full Code Here

TOP

Related Classes of org.htmlparser.beans.StringBean

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.