Detailed introduction to Mybatis's method of handling greater than and less than signs in Xml

黄舟
Release: 2017-03-11 17:39:32
Original
2718 people have browsed it


The first type is to escape the characters

in the Mybatis configuration Xml file. Strictly speaking, The only characters "<" and "&" are illegal in XML. Ellipses, quotation marks, and greater-than signs are legal, but it's good practice to replace them with entity quotes.

"<" will generate an error because the parser will interpret this character as the beginning of a new element.
"&" will also generate an error because the parser will interpret this character as the beginning of the character entity .

Solution, use Xmlescape character instead:

##escape symbol Representative symbols#<>##&& and ''single quotes"“Double quotes

##Second Kind, CDATA

CDATA refers to text data (Unparsed Character Data) that should not be parsed by the XML parser. Everything in the CDATA section is ignored by the parser. The CDATA part starts with

and ends with ]]>. Here is an example: <strong> <code>

Introduction
< is less than
> is greater than
##Second type, CDATA
<![CDATA[ when min(starttime)<=&#39;12:00&#39; and max(endtime)<=&#39;12:00&#39; ]]>
Copy after login
Comments on the CDATA part

:

The CDATA part cannot contain
String

"]]>". Nested CDATA sections are also not allowed. The "]]>" marking the end of the CDATA section cannot contain spaces or line breaks.

The above is the detailed content of Detailed introduction to Mybatis's method of handling greater than and less than signs in Xml. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template