Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server XQuery: How to avoid "illegal qualified name character" exception?

Tags:

xml

xquery

I'm working on a XQuery that may/can contain characters like ">", "<" and single quotes.

How do I avoid breaking the xml parser?

My xml form is like this

<root>
<container>
  <item>(d.Field <> 0)</item>
</container>
</root>
like image 422
Martin Ongtangco Avatar asked Feb 17 '26 18:02

Martin Ongtangco


1 Answers

The "XML" you've shown isn't XML.

Either of the following would be XML:

<root>
<container>
  <item>(d.Field &lt;&gt; 0)</item>
</container>
</root>

or:

<root>
<container>
  <item><![CDATA[(d.Field <> 0)]]></item>
</container>
</root>
like image 83
Damien_The_Unbeliever Avatar answered Feb 19 '26 12:02

Damien_The_Unbeliever



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!