From: Robert Klemme Date: 2005-07-07T22:25:47+09:00 Subject: Re: Ruby XPath support (was Re: Extract/Parse String?) Mark Thomas wrote: >> Although that'll work for this particular string, I'd rather think >> this is a case for a HTML parser. Apparently the name of a frame is >> wanted and a HTML parser is the safest way to get that info. > > Agree completely. Regular expressions should not be used to parse HTML > or XML. However, XPath is an excellent alternative to regular > expressions in these cases. In XPath, the expression to get the name > of the frame would be '//frame/@name'. > > Since I'm new to Ruby, I have to ask: is there an HTML parser that > supports XPath? I know that LibXML does a great job parsing HTML and I > find XPath to be a terrific way to do it--just about anything you want > to extract becomes a one-liner. Do the Ruby bindings expose this > functionality? If not, is there another library that can do this? Rexml can - but then again, it's "just" an XML parser. Kind regards robert