Package org.htmlparser

Examples of org.htmlparser.Node


    {
        String testHTML =
            "<A \n"
                + "HREF=\"/a?b=c>d&e=f&g=h&i=http://localhost/Testing/Report1.html\">20020702 Report 1</A>";
        createParser(testHTML);
        Node node = Tag.find(parser.getReader(), testHTML, 0);
        assertTrue("Node should be a tag", node instanceof Tag);
        Tag tag = (Tag) node;
        String href = tag.getAttribute("HREF");
        assertStringEquals(
            "Resolved Link",
View Full Code Here


        // register standard scanners (Very Important)
        parser.registerScanners();
        String temp = null;
        for (NodeIterator e = parser.elements(); e.hasMoreNodes();)
        {
            Node newNode = e.nextNode(); // Get the next HTML Node
            temp = newNode.toHtml();
        }
        assertNotNull("No nodes", temp);
        assertEquals(
            "Incorrect HTML output: ",
            "<A HREF=\"http://www.google.com/webhp?hl=en\"></A>",
View Full Code Here

    {
        createParser("<MESSAGE>\n" + "Abhi\n" + "Sri\n" + "</MESSAGE>");
        Parser.setLineSeparator("\r\n");
        NodeIterator e = parser.elements();

        Node node = e.nextNode();
        try
        {
            String result =
                TagScanner.extractXMLData(node, "MESSAGE", parser.getReader());
            assertEquals("Result", "Abhi\r\nSri\r\n", result);
View Full Code Here

    public void testExtractXMLDataSingle() throws ParserException
    {
        createParser("<MESSAGE>Test</MESSAGE>");
        NodeIterator e = parser.elements();

        Node node = (Node) e.nextNode();
        try
        {
            String result =
                TagScanner.extractXMLData(node, "MESSAGE", parser.getReader());
            assertEquals("Result", "Test", result);
View Full Code Here

     * find a match
     */
    public void testIsXMLTag() throws ParserException
    {
        createParser("<OPTION value=\"#\">Select a destination</OPTION>");
        Node node;
        NodeIterator e = parser.elements();
        node = (Node) e.nextNode();
        assertTrue(
            "OPTION tag could not be identified",
            TagScanner.isXMLTagFound(node, "OPTION"));
View Full Code Here

                + "</script>"
                + "<body>"
                + "</body>"
                + "</html>");
        parser.registerScanners();
        Node scriptNodes[] = parser.extractAllNodesThatAre(ScriptTag.class);
        assertType("scriptnode", ScriptTag.class, scriptNodes[0]);
        ScriptTag scriptTag = (ScriptTag) scriptNodes[0];
        assertStringEquals(
            "script code",
            "document.write(\"<script "
View Full Code Here

        if (shouldCreateEndTagAndExit())
        {
            return createEndTagAndRepositionReader();
        }
        scanner.beforeScanningStarts();
        Node currentNode = tag;

        doEmptyXmlTagCheckOn(currentNode);
        if (!endTagFound)
        {
            do
View Full Code Here

                    url,
                    tag.isEmptyXmlTag()),
                new CompositeTagData(tag, endTag, nodeList));
        for (int i = 0; i < newTag.getChildCount(); i++)
        {
            Node child = newTag.childAt(i);
            child.setParent(newTag);
        }
        return newTag;
    }
View Full Code Here

    public void createAppletParamsTable(NodeList children)
    {
        for (int i = 0; i < children.size(); i++)
        {
            Node node = children.elementAt(i);
            if (node instanceof Tag)
            {
                Tag tag = (Tag) node;
                if (tag.getTagName().equals("PARAM"))
                {
View Full Code Here

        feedback = fb;
    }

    public Node peek() throws ParserException
    {
        Node ret;

        if (null == reader)
            ret = null;
        else
            try
View Full Code Here

TOP

Related Classes of org.htmlparser.Node

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.