C#How to use less than sign and greater than sign symbols in xml query?

How to use less than < and greater than > symbols in xml query?

How to use less than < and greater than > symbols in XML instead of &lt and &gt

<Query>select * from tbl_reservation where fair > 1000 and fair < 50000</Query>

Why do you care? Are you trying to make it easier to produce, consume, or read?
Any XML tools used to generate will escape it for you (you aren't just concatenating strings to generate XML are you?).
 – Mads HansenApr 8 '17 at 12:35

You could use a CDATA section, which allows for characters to be included without being escaped:

<Query><![CDATA[select * from tbl_reservation where fair > 1000 and fair < 50000]]></Query>

However, if you are using XML tools to construct your XML, they will handle the character escaping of text() values.

原文地址:https://www.cnblogs.com/grj001/p/12223659.html