Tell me more ×
IT Security Stack Exchange is a question and answer site for IT security professionals. It's 100% free, no registration required.

I was reading a book(The Tangled Web) -- what I list below is my understanding of the steps involved in writing a good markup filter.

     - build an in-memory document tree
     - walk the tree
        - remove unnecessary tags
        - remove unnecessary parameters/values
     - reserialize the document
        - apply escaping to text content and parameter values
     - do not allow "name" and "id" parameters in user supplied markup

I'm looking for recommendations on robust libraries for parsing HTML, in Java. I'm hoping for suggestions on libraries that have been widely audited/used.

So far I have come across the following :-

  1. JSoup, http://jsoup.org/
  2. JTidy, http://jtidy.sourceforge.net/
  3. A similar SO question, http://stackoverflow.com/questions/238036/java-html-parsing
  4. Cobra, http://lobobrowser.org/cobra.jsp
  5. Another list of Java parsers, http://java-source.net/open-source/html-parsers

Because of the large number of parsers that are out there, I'm unsure about which ones to use. My selection criterion would be the robustness of a parser i.e. it should handle malformed input in a defined manner.

share|improve this question
Off topic and no migratable. Lists of software are too point-in-time and don't suit our Q&A sites, especially when replies will probably come down to opinions. – Jeff Ferland Nov 1 '12 at 5:07
Kindly allow me to add more context so that the question will reflect how it probably is not off-topic. – uki Nov 1 '12 at 5:12
1  
I'm a moderator on SO, this would be closed very quickly as not constructive if migrated. First, it's mostly theoretical as there's no concrete implementation being discussed, then it ends with asking for a list of recommendations. The second could be fixed, but without an actual problem related to a concrete implementation, it's just not a good fit. – Tim Post Nov 1 '12 at 6:09
I understand, thanks for clarifying. I'll delete this qn asap. – uki Nov 1 '12 at 7:09

closed as off topic by Jeff Ferland Nov 1 '12 at 5:05

Questions on IT Security Stack Exchange are expected to relate to IT security within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

Browse other questions tagged or ask your own question.