I've written a parsing program that appraises lists of information and appends the price at the end of the entry. I'm using HTMLUnit to get a string of the page I want to view using asText(). My code snippet reads as follows:

HtmlPage page = wc.getPage(name.substring(0, name.length() - 1));
wc.waitForBackgroundJavaScriptStartingBefore(100);
String test = page.asText();

In one of my cases, the string has an index count of 111,471 (according to the Eclipse debugger) and it ends in "...", which I'm assuming means this particular variable has no more space in the memory to store additional information. The string as is doesn't contain the entire webpage and the bit I need to extract is at the very bottom of the page. Is there a way I can parse strings of this size?

有帮助吗?

解决方案

Are you sure that the string as is doesn't contain the entire webpage? Printing strings to the console can lead to ellipsis (or truncating, shown as ...) if the string is very long. That doesn't mean however, that it's cut off at the point of ellipsis.

Have you tried treating the string, and did you get any errors? Or do you just assume that it is incomplete?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top