Re: [Htmlparser-user] use with Google App Engine
Brought to you by:
derrickoswald
From: Andy W. <an...@aw...> - 2009-12-17 10:44:14
|
For anyone having this problem in future, here is a workaround (exception handling omitted): // get the html 'the Google way' URL url = new URL(TEST_URL); BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); String line = null; StringBuilder buf = new StringBuilder(); while ((line = reader.readLine()) != null) { buf.append(line); buf.append(System.getProperty ("line.separator")); } reader.close(); // use createPaser method that expects html string Parser parser = Parser.createParser(buf.toString(), null); StringBean sb = new StringBean (); parser.visitAllNodesWith (sb); return (sb.getStrings ()); |