This section describes how to use Mybatis to process greater than or less than signs in Xml.

Source: Internet
Author: User
Tags xml parser
First, the escape character is used to configure the Xml file in Mybatis. Strictly speaking, it is invalid to have only the characters "& lt;" and "& amp;" in XML. Ellipsis, quotation marks, and greater than signs are valid, but it is a good habit to replace them with entity references. "& Lt;" produces an error because the parser interprets the character as the beginning of the new element. "& Amp;" also produces errors because the parser interprets the character as the beginning of the character entity. Solution: Use an Xml escape character instead of an escape character.
First, escape characters

Strictly speaking, it is illegal to configure the Xml file in Mybatis to have only the characters "<" and "&" in XML. Ellipsis, quotation marks, and greater than signs are valid, but it is a good habit to replace them with entity references.

"<" Produces an error because the parser interprets the character as the beginning of the new element.
"&" Also produces an error because the parser interprets the character as the beginning of the character entity.

Solution: Use an Xml escape character instead:

Escape characters Symbol Introduction
< < Less
> > Greater
& & And
' ' Single quotes
" " Double quotation marks

Second, CDATA

CDATA refers to the text Data that should not be parsed by the XML parser (Unparsed Character Data ). All content in the CDATA section is ignored by the parser. CDATA</code></strong> 开始,由<strong><code>The following is an instance:

Second, CDATA

 when min(starttime)<=&#39;12:00&#39; and max(endtime)<=&#39;12:00&#39; 

Comments about CDATA:
The CDATA part cannot contain the string "]> ". The nested CDATA section is not allowed.
The "]>" ending with the CDATA part cannot contain spaces or lines.

The above is a detailed description of how Mybatis processes numbers greater than and smaller than in Xml. For more information, see other related articles in the first PHP community!

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.