The SAML response should be a well-formed XML document and not a fragment, so we should not try and parse it as a fragment.
Additionally there is a current bug in eXist-db whereby if the SAML response includes an XML Declaration then fn:parse-xml-fragment#1 will throw an incorrect error, for example the following valid XQuery raises an error in eXist-db:
The SAML response should be a well-formed XML document and not a fragment, so we should not try and parse it as a fragment.
Additionally there is a current bug in eXist-db whereby if the SAML response includes an XML Declaration then
fn:parse-xml-fragment#1
will throw an incorrect error, for example the following valid XQuery raises an error in eXist-db: