From: "henryturnerlists@..." Date: 2008-10-07T23:28:03+09:00 Subject: Re: Hpricot elem index/position Well, I suppose there are incorrectly formatted links too... I was talking about correctly formatted links that point to a 400+ status code resource. Something libxml would not pick up since I guess you're talking about its syntax checking bit. Since the entire document is accessible from the Hpricot::Elem it seems plausible to count the characters up to and after the element. A 15min look at the source didn't reveal anything obvious.. Have a nasty feeling that this type of thing would have to be done in the compiled C section of it.. On Oct 7, 2:53 pm, Mark Thomas wrote: > On Oct 7, 3:58 am, "henryturnerli...@googlemail.com" > > wrote: > > Hi Mark, > > > I'm writing a broken link reporting type tool. When I find a dodgy tag > > I'd like to be able to relay the character position and or line number > > to the user. Useful for debugging. > > So, are you really interested in broken *links* (as in a GET does not > return a 200 result code) or broken HTML? I have done the former via > AJAX (jQuery sends links to a backend rails action, and if it is > broken changes the class of the link to display a red background). The > latter may be able to be done with libxml, which reports the character > position of broken input. > > -- Mark.