better error messages when matching with fromHtml or fromXml on DOM document