html - Java Read spcific items such as Title -
this question has reply here:
which html parser best? [closed] 3 answerswhat i'm trying accomplish read text (html) website have entered , stored in str1. have been able open website , print of html code inside. want print words between <title><\title> can print title of page.
url oracle = new url(str1); bufferedreader in = new bufferedreader( new inputstreamreader(oracle.openstream())); string inputline; while ((inputline = in.readline()) != null) system.out.println(inputline); in.close();
you utilize stringbuilder read out lines , append them have websites source in 1 string. can search <title> or </title> in string.
look @ string functions indexof or split, what's between tags.
i'd recommend reading this. http://docs.oracle.com/javase/6/docs/api/java/lang/string.html
java html url bufferedreader
No comments:
Post a Comment