Re: [Htmlparser-developer] about page.getText()
Brought to you by:
derrickoswald
From: Derrick O. <Der...@Ro...> - 2003-10-24 12:07:02
|
The Page you have hasn't had any characters read from it yet (it's character offset is zero), hence it hasn't asked the source for any characters, hence the source isn't ready yet, and has nothing available yet. The ready() method is to check if the next read() may block, so it can't check if there are characters in the stream or URL provided. The getText() method with that signature returns all the text read so far, in your case nothing. Try: Cursor c = new cursor (parser_page, 0); do { } while (0 != parser_page.getCharacter ()); System.out.println("parser_page.getText()="+parser_page.getText()); This is all explained in the javadocs. Derrick du du wrote: > Urgent help: > > When constructing Page with either > Page parser_page = new Page(String ); > OR > Page parser_page = new Page(URLConnection ); > OR > Page parser_page = new Page(InputStream,charset); > I can't get any output from: > System.out.println("parser_page.getText()="+parser_page.getText()); > the result always show: > parser_page.getText()= > But when I added: > Source source = parser_page.getSource(); > System.out.println("source.ready()="+source.ready()+" > source.available()="+source.available()); > Output show: > source.ready()=false source.available()=0 > > Does this means the Page object is not ready to use? Why? > thanks a lot > > henry > > |