On Oct 6, 10:19=A0am, "henryturnerli... / googlemail.com"
<henryturnerli... / googlemail.com> wrote:
> Hey,
>
> Trying to find the String index of an Hpricot::Elem within its doc.
> For example..
>
> doc =3D Hpricot("<a>bob</a><a>james</a><a>dan</a>")
> elem =3D doc.search("a")[1]
> elem.start #=3D> 10 ( the first '<' of the second a tag.)
>
> and eventually the following would be good..
>
> elem.length #=3D> 12
> elem.end #=3D> 21
>
> Any thoughts appreciated!
> Henners

My first thought is: Why do you want that information? Character
position is meaningless in an XML and HTML DOM. Whitespace can change
character positions without affecting the DOM at all.

-- Mark.