SXPath works on SXML in the example above. To convert XML to SXML, use the SSAX parser. To convert badly-formed HTML to SXML use HtmlPrag. If you use WebIt there are versions of SXPath and SSAX that work with it.