Tool to write XPATH automatically for web parser?

html-agility-pack html-parsing xpath

Question

Currently I need to extract data from websites. I tried using HTML Agility Pack, which uses XPATH to extract data. Is there a tool available which automates writing XPATH so that even a naive user can use the configure the parsing tool without writing XPATH. Please provide your valuable suggestions for my scenarios.

NOTE: Some tools are available for writing XPATH but it requires well formed XML but in my case I have malformed HTML documents as input.

Popular Answer

Yes, there is such a tool!

You can certainly use the built in method present in many web browsers (as suggested by Mike). However, there are also additional plugins and utilities.

I've found the Chrome Extension XPath Helper to be the most useful. It serves the same purpose, but it is easy to use and creates more robust XPath expressions (based on attributes such as id) rather than just position. You can also edit the expression inline and see the results in real-time.




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why