[Htmlparser-user] Re: a possible need feature
Brought to you by:
derrickoswald
From: Derrick O. <Der...@ro...> - 2002-12-23 20:59:13
|
David, There is now code in the repository to do this (version 1.3 only available straight out of CVS at the moment). There are now 'URLConnection constructors' on the HTMLParser object. So you would do something like: url = new URL ("http://www.teamstore.com"); connection = (HttpURLConnection)url.openConnection (); connection.setRequestProperty ("User-Agent", "Mozilla/3.0(Windows NT 4.0; U) Opera 6.0 [en]"); // ... and whatever else is required parser = new HTMLParser (connection); for (enumeration = parser.elements (); enumeration.hasMoreNodes ();) // ... process your nodes See the test case HTMLParserTest.testPOST() for a working example. Derrick >Date: Mon, 23 Dec 2002 11:44:51 -0800 (PST) >From: "Navid H.Langaroudi" <na...@ya...> >To: htm...@li... >Subject: [Htmlparser-user] a possible need feature >Reply-To: htm...@li... > >Hi Somik, >I had a problem accessing this site >(www.teamstore.com) which was giving me HTTP error >501. I tried to access the site with Java's >URLConnection class, and again I got same result, >error 501! > >But once I used this setting (see line 3 below), I >gained access to the site, an no more errors: > >1-URL mysite = new URL("http://www.teamstore.com"); >2-URLConnection yc = mysite.openConnection(); >3-yc.setRequestProperty("User-Agent", "Mozilla/3.0 >(Windows NT 4.0; U) Opera 6.0 [en]") ; > > >I was wonder if it is possible to do the same, >"setRequestProperty" with HTMLParser objects? > >I really appreciate it if you could let me know this. > >By the way, I wish you and all others involved in this >project a Happy Xmas and New Year! > >With Best wishes >Navid > |