Parsing and extracting information from (possibly malformed) HTML/XML documents