"Go" processing a SQL statement through XML with less than sign and greater than

Source: Internet
Author: User

When we need to pass xml format processing sql statements are often used < ,<=,>,>=xml format error, which causes the background to xml string converted to xml document times wrong, resulting in a program error.

Such problems often need us to deal with in IBatiS or in a custom XML-processing SQL program. In fact, it is very simple, we just need to replace the following to avoid the above error:

Original symbol < <= > >= & "
Replace symbol &lt; &lt;= &gt; &gt;= &amp; &apos; &quot;


Bad XML format:

<?XML version= "1.0" encoding= "GBK"?> <Queryformtoken= "32sdfj-349sfdnfs32-fsdf348imfg323-df34"TableName= "Hsy_t_customer"pageSize= " the"PageNo= "1"Ordercolumn=""OrderType="">  <sqlcondition>and start_date >= to_date (' 2013-01-01 ', ' yyyy-mm-dd ') and start_date<= To_date(' 2013-01-30 ', ' yyyy-mm-dd ') </sqlcondition>  </Queryform>  

Error in Altova XMLSpy tool, XML does not conform to format requirements.



The correct XML format:

<?XML version= "1.0" encoding= "GBK"?>  <Queryformtoken= "32sdfj-349sfdnfs32-fsdf348imfg323-df34"TableName= "Hsy_t_customer"pageSize= " the"PageNo= "1"Ordercolumn=""OrderType="">  <sqlcondition>and start_date&gt;= To_date (' 2013-01-01 ', ' yyyy-mm-dd ') and start_date&lt;= To_date (' 2013-01-30 ', ' yyyy-mm-dd ')</sqlcondition>  </Queryform>  

Validation passed in the Altova XMLSpy tool.

Original link: http://blog.csdn.net/hu_shengyang/article/details/8513655

"Go" processing a SQL statement through XML with less than sign and greater than

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.