Examples of visitAllNodesWith()


Examples of org.htmlparser.Parser.visitAllNodesWith()

    public String extractText(String htmlPath) {
        String result = "";
        try {
            Parser parser = new Parser (htmlPath);
            TextExtractingVisitor visitor = new TextExtractingVisitor ();
            parser.visitAllNodesWith (visitor);
            result = visitor.getExtractedText();

        } catch (ParserException e1) {
        }
        return result;
View Full Code Here

Examples of org.htmlparser.Parser.visitAllNodesWith()

          if (DebugFile.trace) DebugFile.writeln("new StringBean()");

          StringBean oStrBn = new StringBean();

          try {
            oPrsr.visitAllNodesWith (oStrBn);
          } catch (ParserException pe) {
          throw new MessagingException(pe.getMessage(), pe);
          }

          sTextBody = oStrBn.getStrings();
View Full Code Here

Examples of org.htmlparser.Parser.visitAllNodesWith()

      if (oStrBuff.length()>0) {
        if (Gadgets.indexOfIgnoreCase(oStrBuff.toString(), "<html>")>=0) {
          Parser oPrsr = Parser.createParser(oStrBuff.toString(), null);
          StringBean oStrs = new StringBean();
          try {
            oPrsr.visitAllNodesWith (oStrs);
          } catch (ParserException pe) {
            if (DebugFile.trace) DebugFile.decIdent();
            throw new IOException(pe.getMessage());         
          }
View Full Code Here

Examples of org.htmlparser.Parser.visitAllNodesWith()

      StringBuffer oHtmlBuff = new StringBuffer();
      getText(oHtmlBuff);
      Parser oPrsr = Parser.createParser(oHtmlBuff.toString(), getEncoding());
      StringBean oStrBn = new StringBean();
      try {
        oPrsr.visitAllNodesWith (oStrBn);
      } catch (ParserException pe) {
        throw new MessagingException(pe.getMessage(), pe);
      }
      // Code for HTML parser 1.4
      // oStrBn.setInputHTML(oHtmlBuff.toString());
View Full Code Here

Examples of org.htmlparser.Parser.visitAllNodesWith()

        Parser oPrsr = Parser.createParser(oHtml.toString(), getEncoding());
        StringBean oStrBn = new StringBean();

        try {
          oPrsr.visitAllNodesWith (oStrBn);
        } catch (ParserException pe) {
          throw new MessagingException(pe.getMessage(), pe);
        }

        // Code for HTML parser 1.4
View Full Code Here

Examples of org.htmlparser.Parser.visitAllNodesWith()

        if (DebugFile.trace) DebugFile.writeln("new StringBean()");

        StringBean oStrBn = new StringBean();

        try {
          oPrsr.visitAllNodesWith (oStrBn);
        } catch (ParserException pe) {
          if (DebugFile.trace) {
            DebugFile.writeln("org.htmlparser.util.ParserException " + pe.getMessage());
          }
          throw new MessagingException(pe.getMessage(), pe);
View Full Code Here

Examples of org.htmlparser.Parser.visitAllNodesWith()

    }
   
    Parser parser = Parser.createParser(htmlCode,"UTF-8");
    TextExtractingVisitor visitor = new TextExtractingVisitor();
    try {
      parser.visitAllNodesWith(visitor);
      return visitor.getExtractedText();
    } catch (ParserException e) {
      logger.debug("HTML parsing error: " + htmlCode, e);
    }
    return "";
View Full Code Here

Examples of org.htmlparser.Parser.visitAllNodesWith()

    // replace &nbsp; with whitespace
    stringBean.setReplaceNonBreakingSpaces(true);

    try {
      // Parse the content
      parser.visitAllNodesWith(stringBean);
      cleanedContent = stringBean.getStrings();

    } catch (ParserException ex) {
      throw new RegainException("Error while parsing content: ", ex);
    }
View Full Code Here

Examples of org.htmlparser.Parser.visitAllNodesWith()

      parser.reset();
    }

    try {
      // Parse the content
      parser.visitAllNodesWith(linkVisitor);
      ArrayList<Tag> links = linkVisitor.getLinks();
      htmlPage.setBaseUrl(rawDocument.getUrl());

      // Iterate over all links found
      Iterator linksIter = links.iterator();
View Full Code Here

Examples of org.htmlparser.Parser.visitAllNodesWith()

        Lexer l = new Lexer(str);
        Parser parser = new Parser(l);
        StringBean sb = new StringBean();

        try {
            parser.visitAllNodesWith(sb);
        } catch (ParserException e) {
            log.warn("RETURNING ORIG VAL: " + str);
            return str;
        }
        String ret = sb.getStrings();
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.