|
Author |
Topic: HTML Parser (Read 537 times) |
|
skloopy
|
HTML Parser
« on: Jan 21st, 2003, 10:13am » |
|
Does anyone know or use a good HTML parser for Java that might be used inside Proce55ing? I know that you can do it in swing, but i want to be able to make an applet if I can. Thanks!
|
|
|
|
pollux
|
Re: HTML Parser
« Reply #2 on: Apr 1st, 2003, 7:44pm » |
|
for non-java programmers, how do we integrate all thos libraries inside Processing? i mean, i have not seen "try{}" or "implement" inside processing, so i assume you don't code in the same manner as in java, and i don't know how to compile directly in java (know the sintax basics, but not "how to") i need to read an html/text file updated frequently on an URL. a simple file to be parsed, it just has three variables and it's values. can somebody give an example?
|
pollux | www.frwrd.net
|
|
|
Martin
|
Re: HTML Parser
« Reply #3 on: Apr 2nd, 2003, 4:24pm » |
|
on Apr 1st, 2003, 7:44pm, pollux wrote:for non-java programmers, how do we integrate all thos libraries inside Processing |
| hopefully, this will be available in _beta_ (advanced mode). on Apr 1st, 2003, 7:44pm, pollux wrote:i mean, i have not seen "try{}" or "implement" inside processing, so i assume you don't code in the same manner as in java, and i don't know how to compile directly in java (know the sintax basics, but not "how to") |
| in fact, you do. i have some examples that use try-catch statements and interfaces. Code: Marts m; void setup() { // stuff size(150,150); // do some setup stuff here m = new Marts(); // instantiate a new object //////// for(int i = 0; i<10; i++) { println(); } } void draw() { // stuff println( "int i = " + m.test() ); // print test int i = 1 String s = "hello world"; println( "float f = " + m.testing( s ) ); // print exception and return 0 s = "2.0"; println( "float f = " + m.testing( s ) ); // print 2.0 } interface Martin { public int test(); public float testing( String s ); } class Marts implements Martin { public int test() { int i = 1; return i; } public float testing( String s ) { try { float f = Float.parseFloat( s ); return f; } catch( Exception e ) { println( "'" + s + "' is not a float, returning 0."); return 0; } } } |
| just use the beautify command hehe... on Apr 1st, 2003, 7:44pm, pollux wrote:i need to read an html/text file updated frequently on an URL. a simple file to be parsed, it just has three variables and it's values. can somebody give an example |
| you'll need to tango with the server or wrestle with applet security exceptions. i have an example of dancing with the server to load files from remote urls. pls see http://proce55ing.net/discourse/yabb/board_Contribution_Info_ac_tion_display_num_1047145061.html as for parsing html, you could either import javax.swing and use its parser classes or write your own parser class.
|
|
|
|
|