Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > html parser, some site work only

Thread Tools

html parser, some site work only

Posts: n/a
this code work only some site, why?
Have you some ideas how it make?

import java.util.*;
import javax.swing.text.html.HTML;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.HTMLEditorKit.ParserCallback ;
import javax.swing.text.html.parser.ParserDelegator;
import javax.swing.text.MutableAttributeSet;

class Meta {

public static void main(String[] args) throws, {

Properties props= new Properties(System.getProperties());
props.put("http.proxySet", "true");
props.put("http.proxyHost", "");
props.put("http.proxyPort", "6588");

HTMLEditorKit.ParserCallback callback = new HTMLEditorKit.ParserCallback ()

public void handleSimpleTag(HTML.Tag t, MutableAttributeSet a, int pos) {

if (t == HTML.Tag.META)
System.out.println("META inside");

String attrib = (String) a.getAttribute (HTML.Attribute.NAME);
if (attrib != null)
System.out.println("NAME : "+attrib);
String content =(String) a.getAttribute(HTML.Attribute.CONTENT);
if (content != null)
System.out.println("content : "+content);
String httpequiv = (String)a.getAttribute(HTML.Attribute.HTTPEQUIV);
if (httpequiv != null)
System.out.println("httpequiv : "+httpequiv);
for (int counter = args.length - 1; counter >= 0; counter--)
Reader reader = getReader(args[counter]);
new ParserDelegator().parse(reader, callback, false);
catch (Exception e) {
System.out.println("ERROR IN SITE: "+args[counter]+"Exception"+e);
static Reader getReader(String uri)
throws IOException {

if (uri.startsWith("http:")) {

URLConnection conn=
new URL(uri).openConnection();
return new

} else {

return new FileReader(uri);

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Nat port Forwarding , allows only only some ip Cisco 0 04-17-2008 02:21 PM
Scipts being blocked on secure site only on some PC's Postilion Computer Support 0 05-16-2007 01:03 AM
Weired problem with site-to-site vpn: only one side of the vpn works !? Dirk Westfal Cisco 5 03-14-2006 09:35 PM
How can I restrict that the some ID can only login once in the some time ad ASP .Net 2 08-12-2005 09:14 PM