From: Mark Thomas Date: 2008-10-07T05:13:10+09:00 Subject: Re: Hpricot elem index/position On Oct 6, 10:19 am, "henryturnerli...@googlemail.com" wrote: > Hey, > > Trying to find the String index of an Hpricot::Elem within its doc. > For example.. > > doc = Hpricot("bobjamesdan") > elem = doc.search("a")[1] > elem.start #=> 10 ( the first '<' of the second a tag.) > > and eventually the following would be good.. > > elem.length #=> 12 > elem.end #=> 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.