Package org.htmlparser.tags

Examples of org.htmlparser.tags.HeadTag


        return MATCH_NAME;
    }

    public Tag createTag(TagData tagData, CompositeTagData compositeTagData)
    {
        return new HeadTag(tagData, compositeTagData);
    }
View Full Code Here


        registerTag (new TextareaTag ());
        registerTag (new TitleTag ());
        registerTag (new Div ());
        registerTag (new Span ());
        registerTag (new BodyTag ());
        registerTag (new HeadTag ());
        registerTag (new Html ());
       

        return (this);
    }
View Full Code Here

        parseAndAssertNodeCount(2);
        assertTrue(node[1] instanceof Html);
        Html htmlTag = (Html)node[1];
        assertTrue("The HTML tag should have 3 nodes", 3 == htmlTag.getChildCount ());
        assertTrue("The first child should be a HEAD tag",htmlTag.getChild(0) instanceof HeadTag);
        HeadTag headTag = (HeadTag)htmlTag.getChild(0);
        assertTrue("The HEAD tag should have 2 nodes", 2 == headTag.getChildCount ());
        assertTrue("The second child should be a META tag",headTag.getChild(1) instanceof MetaTag);
        MetaTag metaTag = (MetaTag)headTag.getChild(1);

        assertStringEquals(
            "content",
            "text/html; charset=iso-8859-1",
            metaTag.getAttribute("CONTENT")
View Full Code Here

        createParser("<HTML><HEAD></HTML>");
        parseAndAssertNodeCount(1);
        assertTrue(node[0] instanceof Html);
        Html htmlTag = (Html)node[0];
        assertTrue(htmlTag.getChild(0) instanceof HeadTag);
        HeadTag headTag = (HeadTag)htmlTag.getChild(0);
        assertEquals("toHtml()","<HEAD></HEAD>",headTag.toHtml());
        assertEquals("toHtml()","<HTML><HEAD></HEAD></HTML>",htmlTag.toHtml());
    }
View Full Code Here

        parseAndAssertNodeCount(1);
        assertTrue(node[0] instanceof Html);
        Html htmlTag = (Html)node[0];
        assertTrue(htmlTag.getChild(0) instanceof HeadTag);
        //assertTrue(htmlTag.getChild(1) instanceof BodyTag);
        HeadTag headTag = (HeadTag)htmlTag.getChild(0);
        assertEquals("toHtml()","<HEAD></HEAD>",headTag.toHtml());
        assertEquals("toHtml()","<HTML><HEAD></HEAD><BODY></BODY></HTML>",htmlTag.toHtml());
    }
View Full Code Here

        parseAndAssertNodeCount(1);
        assertTrue("Only node should be an HTML node",node[0] instanceof Html);
        Html html = (Html)node[0];
        assertTrue("HTML node should have one child",1 == html.getChildCount ());
        assertTrue("Only node should be an HEAD node",html.getChild(0) instanceof HeadTag);
        HeadTag head = (HeadTag)html.getChild(0);
        assertTrue("HEAD node should have four children",4 == head.getChildCount ());
        assertTrue("First child should be a title tag",head.getChild(0) instanceof TitleTag);
        titleTag = (TitleTag)head.getChild(0);
    }
View Full Code Here

        parseAndAssertNodeCount(1);
        assertTrue ("Only node is a html tag",node[0] instanceof Html);
        Html html = (Html)node[0];
        assertEquals ("Html node has five children", 5, html.getChildCount ());
        assertTrue ("Second child is a head tag", html.childAt (1) instanceof HeadTag);
        HeadTag head = (HeadTag)html.childAt (1);
        assertEquals ("Head node has two children", 2, head.getChildCount ());
        assertTrue ("Second child is a title tag", head.childAt (1) instanceof TitleTag);
        TitleTag titleTag = (TitleTag)head.childAt (1);
        assertEquals("Title","SISTEMA TERRA, VOL. VI , No. 1-3, December 1997",titleTag.getTitle());
// Note: this will fail because of the extra > inserted to finish the /TITLE tag:
//        assertStringEquals ("toHtml", text, html.toHtml ());
    }
View Full Code Here

        parseAndAssertNodeCount(1);
        assertTrue("Node 1 should be a HTML tag", node[0] instanceof Html);
        Html html = (Html)node[0];
        assertTrue("Html tag should have 2 children", 2 == html.getChildCount ());
        assertTrue("Html 2nd child should be HEAD tag", html.getChild (1) instanceof HeadTag);
        HeadTag head = (HeadTag)html.getChild (1);
        assertTrue("Head tag should have 7 children", 7 == head.getChildCount ());
        assertTrue("Head 6th child should be a link tag", head.getChild (5) instanceof LinkTag);
        LinkTag linkTag = (LinkTag)head.getChild (5);
        assertEquals("Resolved Link","http://www.abc.com/home.cfm",linkTag.getLink());
        assertEquals("Resolved Link Text","Home",linkTag.getLinkText());
    }
View Full Code Here

        parseAndAssertNodeCount(3);
        assertTrue("Third node should be an HTML node",node[2] instanceof Html);
        Html html = (Html)node[2];
        assertTrue("HTML node should have two children",2 == html.getChildCount ());
        assertTrue("Second node should be an HEAD node",html.getChild(1) instanceof HeadTag);
        HeadTag head = (HeadTag)html.getChild(1);
        assertTrue("HEAD node should have eleven children",11 == head.getChildCount ());
        assertTrue("Third child should be a title tag",head.getChild(2) instanceof MetaTag);
        MetaTag metaTag = (MetaTag)head.getChild(2);
        assertStringEquals("Meta Tag Name",description,metaTag.getMetaTagName());
        assertStringEquals("Meta Tag Contents",content,metaTag.getMetaContent());
        assertStringEquals("toHTML()",tag,metaTag.toHtml());
    }
View Full Code Here

        parseAndAssertNodeCount(1);
        assertTrue("First node should be a HTML tag", node[0] instanceof Html);
        Html html = (Html)node[0];
        assertTrue("HTML tag should have one child", 1 == html.getChildCount ());
        assertTrue("First child should be a HEAD tag", html.childAt (0) instanceof HeadTag);
        HeadTag head = (HeadTag)html.childAt (0);
        assertTrue("HEAD tag should have four children", 4 == head.getChildCount ());
        assertTrue("Fourth child should be a STYLE tag", head.childAt (3) instanceof StyleTag);
        StyleTag styleTag = (StyleTag)head.childAt (3);
        assertEquals("Style Code","a.h{background-color:#ffee99}",styleTag.getStyleCode());
    }
View Full Code Here

TOP

Related Classes of org.htmlparser.tags.HeadTag

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.