Help with this parse. can not seem to get what between the H3's
Randy Paries <[email protected]> Wed, 21 Mar 2012 16:05:03 -0500
| Newsgroups | gmane.comp.parsers.htmlparser.user |
|---|---|
| Message-ID | <CAPH+WMrJ5RU9yHFdoVeJy6igkooOEB7uc8qKZnXW71N7x4mw3Q@mail.gmail.com> |
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();
}
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<div class="container" id="container_2">
<h3 id="h3_2">Adding a few</h3> <div class="maindiv" id="div_2">
...new articles in here jus tto flesh it out.
</div><!--end of div_2-->
<div class="stardiv" id="star_2">
<a class="aEdit" href="javascript:editSection('div_2',2);"><img
src="images/edit.png" border=0></a>
<a class="aDelete"
href="javascript:deleteSection('container_2',2);"><img
src="images/delete.png" border=0></a>
</div><!--end of star_2-->
</div>
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure