Package org.htmlparser

Examples of org.htmlparser.PrototypicalNodeFactory


    }

    public void testTagWithSingleQuote() throws ParserException {
        String html = "<tag att=\'a<b\'>";
        createParser(html);
        parser.setNodeFactory (new PrototypicalNodeFactory (true));
        parseAndAssertNodeCount(1);
        assertType("should be Tag",Tag.class,node[0]);
        Tag tag = (Tag)node[0];
        assertStringEquals("html",html,tag.toHtml());
        assertStringEquals("attribute","a<b",tag.getAttribute("att"));
View Full Code Here


     * See feature request #736144 Handle multi-threaded operation.
     */
    public void testThreadSafety() throws Exception
    {
        createParser("<html></html>");
        parser.setNodeFactory (new PrototypicalNodeFactory (true));
        String testHtml1 = "<a HREF=\"/cgi-bin/view_search?query_text=postdate>20020701&txt_clr=White&bg_clr=Red&url=http://localhost/Testing/Report1.html\">20020702 Report 1</A>" +
                            TEST_HTML;

        String testHtml2 = "<a href=\"http://normallink.com/sometext.html\">" +
                            TEST_HTML;
View Full Code Here

     */
    public void testStandAloneToHTML () throws ParserException
    {
        String html = "<input disabled>";
        createParser(html);
        parser.setNodeFactory (new PrototypicalNodeFactory (true));
        parseAndAssertNodeCount (1);
        assertType ("should be Tag", Tag.class, node[0]);
        Tag tag = (Tag)node[0];
        assertStringEquals ("html", html, tag.toHtml ());
    }
View Full Code Here

     */
    public void testMissingValueToHTML () throws ParserException
    {
        String html = "<input disabled=>";
        createParser(html);
        parser.setNodeFactory (new PrototypicalNodeFactory (true));
        parseAndAssertNodeCount (1);
        assertType ("should be Tag", Tag.class, node[0]);
        Tag tag = (Tag)node[0];
        assertStringEquals ("html", html, tag.toHtml ());
    }
View Full Code Here

        "<TR><TD ALIGN=\"center\">&nbsp;</TD></TR>\n"+
        "<INPUT TYPE=\"hidden\" NAME=\"password\" SIZE=\"20\">\n"+
        "</TABLE>","http://www.google.com/test/index.html");

        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[]
                {
                    new FormTag (),
                    new InputTag (),
                    new TextareaTag (),
View Full Code Here

        "&nbsp;<a href=/preferences?hl=en>Preferences</a><br>&nbsp;&#8226;&nbsp;<a href=/"+
        "language_tools?hl=en>Language Tools</a></font></td></tr></table></form>"
        );

        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[]
                {
                    new FormTag (),
                    new InputTag (),
                    new TextareaTag (),
View Full Code Here

        "&nbsp;<a href=/preferences?hl=en>Preferences</a><br>&nbsp;&#8226;&nbsp;<a href=/"+
        "language_tools?hl=en>Language Tools</a></font></td></tr></table></form>"
        );

        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[]
                {
                    new FormTag (),
                    new InputTag (),
                    new TextareaTag (),
View Full Code Here

        String url = "http://htmlparser.sourceforge.net/test/overflowpage.html";
        int i;
        Node[] nodes;

        parser = new Parser(url);
        PrototypicalNodeFactory factory = new PrototypicalNodeFactory ();
        // we want to expose the repetitive tags
        factory.unregisterTag (new Html ());
        factory.unregisterTag (new HeadTag ());
        factory.unregisterTag (new BodyTag ());
        factory.unregisterTag (new ParagraphTag ());
        parser.setNodeFactory (factory);
        i = 0;
        nodes = new Node[50];
        for (NodeIterator e = parser.elements(); e.hasMoreNodes();)
            nodes[i++] = e.nextNode();
View Full Code Here

    public void testSearchFor() throws ParserException
    {
        createParser(FORM_HTML);

        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[]
                {
                    new FormTag (),
                    new InputTag (),
                    new TextareaTag (),
View Full Code Here

    public void testSearchByName() throws ParserException
    {
        createParser(FORM_HTML);

        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[]
                {
                    new FormTag (),
                    new InputTag (),
                    new TextareaTag (),
View Full Code Here

TOP

Related Classes of org.htmlparser.PrototypicalNodeFactory

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.