Package org.htmlparser.tags.data

Examples of org.htmlparser.tags.data.TagData


     * This is the reproduction of a bug which causes a null pointer exception
     */
    public void testExtractLinkInvertedCommasBug() throws ParserException
    {
        String tagContents = "a href=r/anorth/top.html";
        Tag tag = new Tag(new TagData(0, 0, tagContents, ""));
        String url = "c:\\cvs\\html\\binaries\\yahoo.htm";
        LinkScanner scanner = new LinkScanner("-l");
        assertEquals(
            "Extracted Link",
            "r/anorth/top.html",
View Full Code Here


    public void testReplaceFaultyTagWithEndTag() throws ParserException
    {
        String currentLine =
            "<p>Site Comments?<br><a href=\"mailto:sam@neurogrid.com?subject=Site Comments\">Mail Us<a></p>";
        Tag tag = new Tag(new TagData(85, 87, "a", currentLine));
        LinkScanner linkScanner = new LinkScanner();
        String newLine =
            linkScanner.replaceFaultyTagWithEndTag(tag, currentLine);
        assertEquals(
            "Expected replacement",
View Full Code Here

    }

    public void testInsertEndTagBeforeTag() throws ParserException
    {
        String currentLine = "<a href=s/7509><b>Yahoo! Movies</b></a>";
        Tag tag = new Tag(new TagData(0, 14, "a href=s/7509", currentLine));
        LinkScanner linkScanner = new LinkScanner();
        String newLine = linkScanner.insertEndTagBeforeNode(tag, currentLine);
        assertEquals(
            "Expected insertion",
            "</A><a href=s/7509><b>Yahoo! Movies</b></a>",
View Full Code Here

            new StringNode(new StringBuffer("Script Code"), 0, 0);
        NodeList childVector = new NodeList();
        childVector.add(stringNode);
        ScriptTag scriptTag =
            new ScriptTag(
                new TagData(0, 10, "Tag Contents", "tagline"),
                new CompositeTagData(null, null, childVector));

        assertNotNull("Script Tag object creation", scriptTag);
        assertEquals("Script Tag Begin", 0, scriptTag.elementBegin());
        assertEquals("Script Tag End", 10, scriptTag.elementEnd());
View Full Code Here

        char ch;
        char[] ignorechar = new char[1];
        // holds the character we're looking for when in TAG_IGNORE_DATA_STATE
        Tag tag =
            new Tag(
                new TagData(
                    position,
                    0,
                    reader.getLastLineNumber(),
                    0,
                    "",
View Full Code Here

        String endTagName = tag.getTagName();
        int endTagBegin = pos;
        int endTagEnd = endTagBegin + endTagName.length() + 2;
        endTag =
            new EndTag(
                new TagData(endTagBegin, endTagEnd, endTagName, currLine));
    }
View Full Code Here

            tagEnd = i;
            state = ENDTAG_FINISHED_PARSING_STATE;
        }
        if (state == ENDTAG_FINISHED_PARSING_STATE)
            return new EndTag(
                new TagData(tagBegin, tagEnd, tagContents.toString(), input));
        else
            return null;
    }
View Full Code Here

        int endTagEnd = endTagBegin + endTagName.length() + 2;
        possibleEndTagCauser.setTagBegin(endTagEnd + 1);
        reader.addNextParsedNode(possibleEndTagCauser);
        endTag =
            new EndTag(
                new TagData(endTagBegin, endTagEnd, endTagName, currLine));
    }
View Full Code Here

    private Tag createTag() throws ParserException
    {
        CompositeTag newTag =
            (CompositeTag) scanner.createTag(
                new TagData(
                    tag.elementBegin(),
                    endTag.elementEnd(),
                    startingLineNumber,
                    endingLineNumber,
                    tag.getText(),
View Full Code Here

    public void testTypeHttps() throws ParserException
    {
        LinkTag linkTag =
            new LinkTag(
                new TagData(0, 0, "", ""),
                new CompositeTagData(null, null, null),
                new LinkData("https://www.someurl.com", "", "", false, false));
        assertTrue("This is a https link", linkTag.isHTTPSLink());
    }
View Full Code Here

TOP

Related Classes of org.htmlparser.tags.data.TagData

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.