/** * Construct a parser using the provided lexer and feedback object. * This would be used to create a parser for special cases where the * normal creation of a lexer on a URLConnection needs to be customized. * @param lexer The lexer to draw characters from. * @param fb The object to use when information, * warning and error messages are produced. If <em>null</em> no feedback * is provided. */ public Parser (Lexer lexer, ParserFeedback fb) { setFeedback (fb); if (null == lexer) throw new IllegalArgumentException ("lexer cannot be null"); setLexer (lexer); setNodeFactory (new PrototypicalNodeFactory ()); }
/** * Construct a parser using the provided lexer and feedback object. * This would be used to create a parser for special cases where the * normal creation of a lexer on a URLConnection needs to be customized. * @param lexer The lexer to draw characters from. * @param fb The object to use when information, * warning and error messages are produced. If <em>null</em> no feedback * is provided. */ public Parser (Lexer lexer, ParserFeedback fb) { setFeedback (fb); setLexer (lexer); setNodeFactory (new PrototypicalNodeFactory ()); }
Parser parser = Parser.createParser(result, "UTF-8"); PrototypicalNodeFactory factory = new PrototypicalNodeFactory(); parser.setNodeFactory(factory); NodeIterator itr = parser.elements(); processNodes(buf, itr, false, overrideDocumentType); parser.setNodeFactory(factory); NodeIterator itr = parser.elements(); processNodes(buf, itr, true);
parser.setNodeFactory(factory); NodeIterator itr = parser.elements(); processNodes(buf, itr, false, overrideDocumentType); parser.setNodeFactory(factory); NodeIterator itr = parser.elements(); processNodes(buf, itr, true);
parser.setNodeFactory(factory); NodeIterator itr = parser.elements(); processNodes(buf, itr, false, overrideDocumentType); parser.setNodeFactory(factory); NodeIterator itr = parser.elements(); processNodes(buf, itr, true);
/** * Creates a Parser object with the location of the resource (URL or file) * You would typically create a DefaultHTMLParserFeedback object and pass * it in. * @see #Parser(URLConnection,ParserFeedback) * @param resource Either a URL, a filename or a string of HTML. * The string is considered HTML if the first non-whitespace character * is a <. The use of a url or file is autodetected by first attempting * to open the resource as a URL, if that fails it is assumed to be a file * name. * A standard HTTP GET is performed to read the content of the URL. * @param feedback The HTMLParserFeedback object to use when information, * warning and error messages are produced. If <em>null</em> no feedback * is provided. * @throws ParserException If the URL is invalid. */ public Parser (String resource, ParserFeedback feedback) throws ParserException { setFeedback (feedback); setResource (resource); setNodeFactory (new PrototypicalNodeFactory ()); }
/** * Create a web site capturer. */ public SiteCapturer () { PrototypicalNodeFactory factory; mSource = null; mTarget = null; mPages = new ArrayList (); mFinished = new HashSet (); mImages = new ArrayList (); mCopied = new HashSet (); mParser = new Parser (); factory = new PrototypicalNodeFactory (); factory.registerTag (new LocalLinkTag ()); factory.registerTag (new LocalFrameTag ()); factory.registerTag (new LocalBaseHrefTag ()); factory.registerTag (new LocalImageTag ()); mParser.setNodeFactory (factory); mCaptureResources = true; mFilter = null; }
parser.setNodeFactory(m_nodeFactory); Lexer lexer = new Lexer(); Page page = new Page(html, encoding);
parser.setNodeFactory(m_nodeFactory); Lexer lexer = new Lexer(); Page page = new Page(content);
parser.setNodeFactory(m_nodeFactory); Lexer lexer = new Lexer(); Page page = new Page(content);