Friday, May 6, 2011

Extract div content from htmlsource in string (Java)

Hi all, i'm trying to extract the content of an special div-tag(defined by his classname) out of a string that contains html source. I think the regexp-features of Java are not as easy to use as in perl, right?

Does anyone did this before and can give me a piece of code? perhaps dom-browsing is a good solution, but i didn't found any tutorials, matching to my problem.

From stackoverflow
  • Based on your comments it sounds like you have a general case ("crawler") and thus you're effectively parsing an XML file. If the source page is xhtml, then you have a variety of options in various XML libraries. (JDom, for example).

  • You could use HTML Parser or some other HTML parsing library from this list.

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.