Package org.htmlparser.util

Examples of org.htmlparser.util.DefaultParserFeedback


    System.out.println("***************************************");
    System.out.println("*    Test With Scanners Registered    *");
    System.out.println("***************************************");         
    for (int i=0;i<=numTimes;i++) {
      // Create the parser object
      parser = new Parser(file,new DefaultParserFeedback());
      parser.registerScanners();
      Node node;
      long start=System.currentTimeMillis();
      for (NodeIterator e = parser.elements();e.hasMoreNodes();) {
        node = e.nextNode();
View Full Code Here


    }

    public int countImageTagsWithHTMLParser() throws ParserException
    {
        Parser parser =
            new Parser("http://www.yahoo.com", new DefaultParserFeedback());
        parser.addScanner(new ImageScanner("-i", new LinkProcessor()));
        int parserImgTagCount = 0;
        Node node;
        for (NodeIterator e = parser.elements(); e.hasMoreNodes();)
        {
View Full Code Here

    // find nodes
    Node[] tags;
    {
      String htmlContents = IOUtils2.readString(htmlFile);
      Lexer lexer = new Lexer(new Page(htmlContents));
      Parser parser = new Parser(lexer, new DefaultParserFeedback(DefaultParserFeedback.QUIET));
      TagFindingVisitor visitor = new TagFindingVisitor(new String[]{tagName});
      parser.visitAllNodesWith(visitor);
      tags = visitor.getTags(0);
    }
    // convert into List<TagNode>
View Full Code Here

        try
        {
            String contents= new String(html);
            StringReader reader= new StringReader(contents);
            NodeReader nreader= new NodeReader(reader, contents.length());
            htmlParser= new Parser(nreader, new DefaultParserFeedback());
            addTagListeners(htmlParser);
        }
        catch (Exception e)
        {
            throw new HTMLParseException(e);
View Full Code Here

                            input.getEncoding ())));
                locator = new Locator (mParser);
                if (null != mErrorHandler)
                    feedback = new Feedback (mErrorHandler, locator);
                else
                    feedback = new DefaultParserFeedback (0);
                mParser.setFeedback (feedback);
                mContentHandler.setDocumentLocator (locator);
                try
                {
                    mContentHandler.startDocument ();
View Full Code Here

                mParser = new Parser (systemId);
                locator = new Locator (mParser);
                if (null != mErrorHandler)
                    feedback = new Feedback (mErrorHandler, locator);
                else
                    feedback = new DefaultParserFeedback (DefaultParserFeedback.QUIET);
                mParser.setFeedback (feedback);

                // OK, try a simplistic parse
                mContentHandler.setDocumentLocator (locator);
                try
View Full Code Here

      }

    };

    Parser parser = new Parser();
    parser.setFeedback( new DefaultParserFeedback() );
    parser.setInputHTML( content );

    NodeList list = parser.parse( null );
    list.visitAllNodesWith( linkVisitor );
View Full Code Here

                            input.getEncoding ())));
                locator = new Locator (mParser);
                if (null != mErrorHandler)
                    feedback = new Feedback (mErrorHandler, locator);
                else
                    feedback = new DefaultParserFeedback (0);
                mParser.setFeedback (feedback);
                mContentHandler.setDocumentLocator (locator);
                try
                {
                    mContentHandler.startDocument ();
View Full Code Here

                mParser = new Parser (systemId);
                locator = new Locator (mParser);
                if (null != mErrorHandler)
                    feedback = new Feedback (mErrorHandler, locator);
                else
                    feedback = new DefaultParserFeedback (DefaultParserFeedback.QUIET);
                mParser.setFeedback (feedback);

                // OK, try a simplistic parse
                mContentHandler.setDocumentLocator (locator);
                try
View Full Code Here

            out.println ("<body>");
            out.println ("This is a test page ");
            out.println ("</body>");
            out.println ("</html>");
            out.close ();
            parser = new Parser (file.getAbsolutePath (), new DefaultParserFeedback(DefaultParserFeedback.QUIET));
            parser.setNodeFactory (new PrototypicalNodeFactory (true));
            nodes = new Node[30];
            i = 0;
            for (enumeration = parser.elements (); enumeration.hasMoreNodes ();)
            {
View Full Code Here

TOP

Related Classes of org.htmlparser.util.DefaultParserFeedback

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.