Package org.htmlparser

Examples of org.htmlparser.PrototypicalNodeFactory


            "<custom>" +
                "<another><abcdefg>\n" +
            "</custom>"
        );
        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[]
                {
                    new CustomTag (),
                    new AnotherTag (true),
                }));
View Full Code Here


        String tag1 = "<custom>";
        String tag2 = "<custom>something</custom>";
        String tag3 = "</custom>";
        createParser(tag1 + tag2 + tag3);
        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[] {
                    new CustomTag (false),
                    new AnotherTag (false),
                }));
        parseAndAssertNodeCount(3);
View Full Code Here

        String tag1 = "<custom>";
        String tag2 = "<custom>something</custom>";
        String tag3 = "</custom>";
        createParser(tag1 + tag2 + tag3);
        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[] {
                    new CustomTag (false),
                    new AnotherTag (false),
                }));
        parseAndAssertNodeCount(3);
View Full Code Here

    }

    public void testUrlBeingProvidedToCreateTag() throws ParserException {
        createParser("<Custom/>","http://www.yahoo.com");

        parser.setNodeFactory (new PrototypicalNodeFactory (new CustomTag ()));
        parseAndAssertNodeCount(1);
        assertStringEquals("url","http://www.yahoo.com",((AbstractNode)node[0]).getPage ().getUrl ());
    }
View Full Code Here

                    "<another>" +
                "</custom>" +
            "</custom>"
        );
        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[] {
                    new CustomTag (),
                    new AnotherTag (false),
                }));
        parseAndAssertNodeCount(1);
View Full Code Here

            "World" +
            "<custom>\n" +
            "Hey\n" +
            "</custom>"
        );
        parser.setNodeFactory (new PrototypicalNodeFactory (new CustomTag (false)));
        parseAndAssertNodeCount(3);
        for (int i=0;i<nodeCount;i++) {
            assertType("node "+i,CustomTag.class,node[i]);
        }
    }
View Full Code Here

    }

    public void testScan() throws ParserException {
        createParser("<html><head><title>Yahoo!</title><base href=http://www.yahoo.com/ target=_top><meta http-equiv=\"PICS-Label\" content='(PICS-1.1 \"http://www.icra.org/ratingsv02.html\" l r (cz 1 lz 1 nz 1 oz 1 vz 1) gen true for \"http://www.yahoo.com\" r (cz 1 lz 1 nz 1 oz 1 vz 1) \"http://www.rsac.org/ratingsv01.html\" l r (n 0 s 0 v 0 l 0) gen true for \"http://www.yahoo.com\" r (n 0 s 0 v 0 l 0))'><style>a.h{background-color:#ffee99}</style></head>");
        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[]
                {
                    new TitleTag (),
                    new StyleTag (),
                    new MetaTag (),
View Full Code Here

        "<html><head><TITLE>\n"+
        "<html><head><TITLE>\n"+
        "Double tags can hang the code\n"+
        "</TITLE></head><body>\n"+
        "<body><html>");
        parser.setNodeFactory (new PrototypicalNodeFactory (new TitleTag ()));
        parseAndAssertNodeCount(9);
        assertTrue("Third tag should be a title tag",node[2] instanceof TitleTag);
        TitleTag titleTag = (TitleTag)node[2];
        assertEquals("Title","\n",titleTag.getTitle());
        assertTrue("Fourth tag should be a title tag",node[3] instanceof TitleTag);
View Full Code Here

    public void testTitleTagContainsJspTag() throws ParserException {
        String title = "<title><%=gTitleString%></title>";
        createParser("<html><head>" + title + "<base href=http://www.yahoo.com/ target=_top><meta http-equiv=\"PICS-Label\" content='(PICS-1.1 \"http://www.icra.org/ratingsv02.html\" l r (cz 1 lz 1 nz 1 oz 1 vz 1) gen true for \"http://www.yahoo.com\" r (cz 1 lz 1 nz 1 oz 1 vz 1) \"http://www.rsac.org/ratingsv01.html\" l r (n 0 s 0 v 0 l 0) gen true for \"http://www.yahoo.com\" r (n 0 s 0 v 0 l 0))'><style>a.h{background-color:#ffee99}</style></head>");
        parser.setNodeFactory (
            new PrototypicalNodeFactory (
                new Tag[]
                {
                    new TitleTag (),
                    new BaseHrefTag (),
                    new MetaTag (),
View Full Code Here

        NodeIterator iterator;
        Node node;

        html = "<" + tagContents + ">";
        createParser (html);
        parser.setNodeFactory (new PrototypicalNodeFactory (true));
        try
        {
            iterator = parser.elements ();
            node = iterator.nextNode ();
            if (node instanceof Tag)
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.