Package org.htmlparser.tags

Examples of org.htmlparser.tags.BodyTag


                // first we check to see if body tag has a
                // background set and we set the NodeIterator
                // to the child elements inside the body
                if (node instanceof BodyTag)
                {
                    BodyTag body= (BodyTag)node;
                    binUrlStr= body.getAttribute("background");
                    // if the body tag exists, we get the elements
                    // within the body tag. if we don't we won't
                    // see the body of the page. The only catch
                    // with this is if there are images after the
                    // closing body tag, it won't get parsed. If
                    // someone puts it outside the body tag, it
                    // is probably a mistake. Plus it's bad to
                    // have important content after the closing
                    // body tag. Peter Lin 10-9-03
                    e= body.elements();
                }
                else if (node instanceof BaseHrefTag)
                {
                    BaseHrefTag baseHref= (BaseHrefTag)node;
                    try
View Full Code Here


        return MATCH_NAME;
    }

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

        BodyScanner bodyScanner = new BodyScanner("-b");
        parser.addScanner(bodyScanner);
        parseAndAssertNodeCount(6);
        assertTrue(node[4] instanceof BodyTag);
        // check the body node
        BodyTag bodyTag = (BodyTag) node[4];
        assertEquals("Body", "This is a body tag", bodyTag.getBody());
        assertEquals(
            "Body",
            "<BODY>This is a body tag</BODY>",
            bodyTag.toHtml());
        assertEquals("Body Scanner", bodyScanner, bodyTag.getThisScanner());
    }
View Full Code Here

        BodyScanner bodyScanner = new BodyScanner("-b");
        parser.addScanner(bodyScanner);
        parseAndAssertNodeCount(6);
        assertTrue(node[4] instanceof BodyTag);
        // check the body node
        BodyTag bodyTag = (BodyTag) node[4];
        assertStringEquals(
            "Body",
            "<BODY><%=BodyValue%></BODY>",
            bodyTag.toHtml());
        assertEquals("Body Scanner", bodyScanner, bodyTag.getThisScanner());
    }
View Full Code Here

        BodyScanner bodyScanner = new BodyScanner("-b");
        parser.addScanner(bodyScanner);
        parseAndAssertNodeCount(6);
        assertTrue(node[4] instanceof BodyTag);
        // check the body node
        BodyTag bodyTag = (BodyTag) node[4];
        assertEquals(
            "Body",
            "<BODY>before jsp<%=BodyValue%>after jsp</BODY>",
            bodyTag.toHtml());
        assertEquals("Body Scanner", bodyScanner, bodyTag.getThisScanner());
    }
View Full Code Here

        BodyScanner bodyScanner = new BodyScanner("-b");
        parser.addScanner(bodyScanner);
        parseAndAssertNodeCount(3);
        assertTrue(node[1] instanceof BodyTag);
        // check the body node
        BodyTag bodyTag = (BodyTag) node[1];
        assertEquals(
            "Body",
            "<BODY>before jsp<%=BodyValue%>after jsp</BODY>",
            bodyTag.toHtml());
        assertEquals("Body Scanner", bodyScanner, bodyTag.getThisScanner());
    }
View Full Code Here

                // first we check to see if body tag has a
                // background set and we set the NodeIterator
                // to the child elements inside the body
                if (node instanceof BodyTag)
                {
                    BodyTag body= (BodyTag)node;
                    binUrlStr= body.getAttribute("background");
                    // if the body tag exists, we get the elements
                    // within the body tag. if we don't we won't
                    // see the body of the page. The only catch
                    // with this is if there are images after the
                    // closing body tag, it won't get parsed. If
                    // someone puts it outside the body tag, it
                    // is probably a mistake. Plus it's bad to
                    // have important content after the closing
                    // body tag. Peter Lin 10-9-03
                    e= body.elements();
                }
                else if (node instanceof BaseHrefTag)
                {
                    BaseHrefTag baseHref= (BaseHrefTag)node;
                    try
View Full Code Here

        registerTag (new TableTag ());
        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

        Node node;

        try
        {
            createParser("<body style=\"margin-top:4px; margin-left:20px;\" title=\"body\">");
            parser.setNodeFactory (new PrototypicalNodeFactory (new BodyTag ()));
            iterator = parser.elements ();
            node = null;
            while (iterator.hasMoreNodes ())
            {
                node = iterator.nextNode ();
View Full Code Here

        createParser("<html><head><title>Test 1</title></head><body>This is a body tag</body></html>");
        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[]
                {
                    new BodyTag (),
                    new TitleTag (),
                }));
        parseAndAssertNodeCount(6);
        assertTrue(node[4] instanceof BodyTag);
        // check the body node
        BodyTag bodyTag = (BodyTag) node[4];
        assertEquals("Body","This is a body tag",bodyTag.getBody());
        assertEquals("Body","<body>This is a body tag</body>",bodyTag.toHtml());
    }
View Full Code Here

TOP

Related Classes of org.htmlparser.tags.BodyTag

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.