/**
Returns an HTML representation of the news feed being
parsed.
*/
public synchronized String parse
(){
try{
XMLReader xr =
XMLReaderFactory.
createXMLReader();
xr.
setContentHandler(this);
xr.
setErrorHandler(this);
URL u=
new URL(Url
);
URLConnection UC=u.
openConnection();
/*If we don't set the user-agent property sites like
Google won't let you access their feeds.*/
UC.
setRequestProperty ( "User-agent",
"www.plink-search.com");
InputStreamReader r =
new InputStreamReader(UC.
getInputStream());
xr.
parse(new InputSource(r
));
}catch(Exception e
){
}
//Output all the parsed news items as HTML.
for(int i=
0;i<News.
size();i++
){
output+=
"<div class=\"search"+
(i%
2)+
"\">";
output+=
((NewsItem
)News.
get(i
)).
toString();
output+=
"</div>";
}
return(output
);
}