21 Mar 2012 22:05
Help with this parse. can not seem to get what between the H3's
Randy Paries <rtparies <at> gmail.com>
2012-03-21 21:05:03 GMT
2012-03-21 21:05:03 GMT
hello,
I have the snippet of html(see below) and i need to get the content of
the <h3 id=h3_2.>
there a bunch of these container divs with unqiue id's in my file.
I can get the divs and their inner html just fine. I can not figure
out how to get the whats between the H3 tags
this snippet of code works for divs but not the h3:
if finds the h3 with the correct ID, i just can not figure out how to
get the innerHTML or whats between the <h3> tags.
thanks for any help
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//tag = is the container_2 info
innerparser = new Parser();
innerparser.setInputHTML(tag.toHtml());
innerparser.setEncoding("UTF-8");
innerNodes = innerparser.extractAllNodesThatMatch(
new TagNameFilter("h3") );
for (int x=0; x<innerNodes.size(); x++){
TagNode itag = (TagNode)innerNodes.elementAt(x);
String innerIdAttribute = itag.getAttribute("id");
if ( innerIdAttribute != null &&
innerIdAttribute.equals( "h3_"+num ) ){
System.out.println("id-->"+innerIdAttribute);
h3Data = itag.toHtml();
}
}
(Continue reading)
RSS Feed