[xquery-talk] parsing xml fragments

David Carlisle davidc at nag.co.uk
Sun Jun 21 13:47:44 PDT 2015


On 21/06/2015 21:33, Leo Studer wrote:
> Hi George
>
> thanks for your thoughts. I thought the same in the beginning. And
> when you look in the source $feed there it is escaped but
> parse-xml-fragment does the mess…
>
> Always Leo

It looks to me as if the string is not well formed.

You have essentially

<![CDATA[<img src="aaa?&location=sio"/>]]>

So the input XML document is well formed

but the string you are passing to the xml parser is


<img src="aaa?&location=sio"/>

which is not well formed.

the input should be


<![CDATA[<img src="aaa?&location=sio"/>]]>

If you know all your ampersands are not escaped, and you can't fix the
source documents  you could use a regexp-replace to escape them before
parsing

parse-xml-fragment(replace($feed,'&','&amp;'))

David

________________________________


The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is:

Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.



This e-mail has been scanned for all viruses by Microsoft Office 365.

________________________________



More information about the talk mailing list