# From a URL to XPath 2.0

**URL:** <https://www.ruby-forum.com/t/from-a-url-to-xpath-2-0/129713>\
**Category:** Ruby\
**Created:** [February 20, 2008, 10:31pm UTC](https://www.ruby-forum.com/t/from-a-url-to-xpath-2-0/129713 "2008-02-20T22:31:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![evansenter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e274bd/32.png) [@evansenter](https://www.ruby-forum.com/u/evansenter)\
**Post date:** [February 20, 2008, 10:31pm UTC](https://www.ruby-forum.com/t/from-a-url-to-xpath-2-0/129713/1 "2008-02-20T22:31:47Z")

</div>

Hi,

I am trying to write a small script that allows me to scrape HTML using  
XPath 2.0. As much as I enjoyed using hPricot, it’s lack of support for  
indexed paths has forced me to look to a different tool (I’ve heard  
REXML has the best XPath support). In order to use REXML however, I need  
to first convert the HTML to XML and I’m yet to find a good gem / plugin  
to do that.

As I mentioned however, my main interest is having index support for  
XPath queries against an HTML page arbitrarily pulled from a generated  
URL. Anyone know of a good approach to handle this?

Thank you,

Ruby.new(user)

---

<div class="post-metadata">

**Author:** ![evansenter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e274bd/32.png) [@evansenter](https://www.ruby-forum.com/u/evansenter)\
**Post date:** [February 21, 2008, 6:04am UTC](https://www.ruby-forum.com/t/from-a-url-to-xpath-2-0/129713/2 "2008-02-21T06:04:59Z")

</div>

Evan Senter wrote:

> As I mentioned however, my main interest is having index support for

Hi, you might want to try HTML tidy

project : [http://tidy.sourceforge.net/](http://tidy.sourceforge.net/)  
try it online (output XML): [HTML Tidy Online](http://infohound.net/tidy/)
