Package org.htmlparser.util

Examples of org.htmlparser.util.NodeIterator.nextNode()


    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


            parser.addScanner(new BodyScanner("-b"));
            iterator = parser.elements();
            node = null;
            while (iterator.hasMoreNodes())
            {
                node = iterator.nextNode();
                if (node instanceof BodyTag)
                {
                    attributes = ((BodyTag) node).getAttributes();
                    assertTrue(
                        "no style attribute",
View Full Code Here

        }

        pass = false;
        for (enumeration = parser.elements(); enumeration.hasMoreNodes();)
        {
            node = enumeration.nextNode();
            if (node instanceof StringNode)
            {
                string = (StringNode) node;
                if (-1 != string.getText().indexOf(postal_code))
                    pass = true;
View Full Code Here

            parser = new Parser(file.getAbsolutePath());
            nodes = new Node[30];
            i = 0;
            for (enumeration = parser.elements(); enumeration.hasMoreNodes();)
            {
                nodes[i] = enumeration.nextNode();
                i++;
            }
            assertEquals("Expected nodes", 12, i);
        }
        catch (Exception e)
View Full Code Here

    public void setUp() throws Exception
    {
        Parser parser = Parser.createParser(FormScannerTest.FORM_HTML);
        parser.registerScanners();
        NodeIterator e = parser.elements();
        Node node = e.nextNode();
        formTag = (FormTag) node;
        formChildren = new Vector();
        for (SimpleNodeIterator se = formTag.children(); se.hasMoreNodes();)
        {
            formChildren.addElement(se.nextNode());
View Full Code Here

        parser =
            new Parser("http://htmlparser.sourceforge.net/test/example.html");
        enumeration = parser.elements();
        vector = new Vector(50);
        while (enumeration.hasMoreNodes())
            vector.addElement(enumeration.nextNode());

        data = pickle(parser);
        parser = (Parser) unpickle(data);

        enumeration = parser.elements();
View Full Code Here

        enumeration = parser.elements();
        while (enumeration.hasMoreNodes())
            assertEquals(
                "Nodes before and after serialization differ",
                ((Node) vector.remove(0)).toHtml(),
                ((Node) enumeration.nextNode()).toHtml());
    }

    public void testSerializableScanners()
        throws IOException, ClassNotFoundException, ParserException
    {
View Full Code Here

            new Parser("http://htmlparser.sourceforge.net/test/example.html");
        parser.registerScanners();
        enumeration = parser.elements();
        vector = new Vector(50);
        while (enumeration.hasMoreNodes())
            vector.addElement(enumeration.nextNode());

        data = pickle(parser);
        parser = (Parser) unpickle(data);

        enumeration = parser.elements();
View Full Code Here

        enumeration = parser.elements();
        while (enumeration.hasMoreNodes())
            assertEquals(
                "Nodes before and after serialization differ",
                ((Node) vector.remove(0)).toHtml(),
                ((Node) enumeration.nextNode()).toHtml());
    }

    public void testSerializableStringBean()
        throws IOException, ClassNotFoundException, ParserException
    {
View Full Code Here

          Node sibling;
          boolean foundStart = false;
          boolean foundMe = false;
            NodeIterator iter = children.elements();
        while (iter.hasMoreNodes()) {
          sibling = iter.nextNode();
          if (sibling == node) {
            if (!foundStart) {
              //we never found the start boundary
              return false;
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.