This method parse strings in a GLib.File using Html.Doc.read_memory method. Refer to libxml2 documentation about limitations on parsing.
In order to use a different parser, may you want to load in memory your file, then create a new XHtmlDocument using a constructor better fitting your document content or source.