XML 中转义的特殊字符

特殊字符 描述 转义后的形式
& (Ampersand) 实体引用起始符号 &
< (Less Than) 元素标签开始符号 &lt;
> (Greater Than) 元素标签结束符号 &gt;
" (双引号) 用于属性值包围的符号 &quot;
' (单引号) 在某些情况下用于属性值包围(非必须转义,但推荐) '

举例展示:

原始文本 转义后文本
<example> &lt;example&gt;
"Hello World!" &quot;Hello World!&quot;
'This is a test.' 'This is a test.''
This & that This &amp; that
相关推荐
写代码的【黑咖啡】5 小时前
Python中的lxml:高效XML处理库
xml·开发语言·python
spencer_tseng1 天前
org.xml.sax.SAXParseException: cvc-complex-type.3.2.2 sql-query result-type
xml
派大鑫wink1 天前
【Day48】MyBatis 注解开发:替代 XML 映射文件
xml·java·mybatis
sunnyday04262 天前
Spring Boot 日志配置详解:log4j2.xml 的完整配置指南
xml·spring boot·log4j
熊出没3 天前
关于MyBatis Mapper 接口与 XML 映射机制的分析
xml·microsoft·mybatis
她说..4 天前
FIND_IN_SET()方法
xml·java·spring boot
北辰当尹4 天前
xml基础
android·xml
qqqahhh7 天前
xml文件的动态化配置,导入
xml·spring·springboot
吴声子夜歌7 天前
Maven——pom.xml详解
xml·java·maven
iSee8578 天前
struts2 XML外部实体注入漏洞复现(CVE-2025-68493)
xml·安全·struts2