Hi Andrew,

Thanks for the suggestion... I agree that's the issue, but I'm not quite sure how to work around it. I've tried the following to no avail - how do I replace the & with &? (unfortunately, I can't change the value of $ex, this comes from web-service call)...

let $ex as xs:string := '<exception message="One of ''{&quot;http://www.w3.org/1998/Math/MathML&quot;:semantics}'' is expected."/>'
return
    xdmp:unquote(
        replace($ex, "&", "&amp;")
    )


On 3/3/2010 1:55 PM, Andrew Welch wrote:
On 3 March 2010 18:31, Wyatt VanderStucken<[email protected]>  wrote:
I've been banging my head trying to figure this out - any ideas would be
much appreciated....

let $ex as xs:string := '<exception message="One of
''{&quot;http://www.w3.org/1998/Math/MathML&quot;:semantics}'' is
expected."/>'
return xdmp:unquote($ex)

Always gives error "SystemID: XDMP-DOCSTARTTAGCHAR: xdmp:unquote("<exception
message=&quot;One of '{&quot;http://www.w3.org/1998/M...";) -- Unexpected
character "/" in start tag at  line 1"
That's because&quot; gets resolved to " when the query is parsed, so
your variable $ex becomes:

<exception message="One of '{"http....

..you can see the double quotes that are causing the exception when
you try and parse that as XML using xdmp:unquote.

One answer is to double escape them:

message="One of ''{&amp;quot;

..then after the query is parsed you are left with "&quot;" as expected.

cheers
andrew



_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to