Better implementation for targeted parsing, takes into account MIME type
as well.