不应将哪个字符设置为XML文件中的值 [英] Which character should not be set as values in XML file

查看:114
本文介绍了不应将哪个字符设置为XML文件中的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,当我使用&配置XML文件值时字符,那么XML文件不能正确打开

I notice that when I configured the XML file values with "&" character , then XML file not open correctly

我猜这是因为XML文件值不应该有一些字符&

I guess this is because XML file values should not have some character as &

而&不应该设置为XML文件中的值

And "&" Should not set as value in the XML file

如果有更多的字符不能在XML中设置为值,请咨询? (或者也可以& character是唯一的一个??)

Please advice if there are more characters that should not set in the XML as value? ( or maybe & character is the only the one ?? )

XML中的错误值示例&

Example of bad value from XML "&"

<FolderPath>\EEA\E1\C & W 100\AWQ</FolderPath>

XML中的右行示例

 <FolderPath>\EEA\E1\C and W 100\AWQ</FolderPath>


推荐答案

我会引用你: http://www.w3schools.com/xml/xml_syntax.asp


某些字符在XML中具有特殊含义。

Some characters have a special meaning in XML.

如果放置像<在XML元素内部,它将生成一个错误,因为解析器将其解释为新元素的开始。

If you place a character like "<" inside an XML element, it will generate an error because the parser interprets it as the start of a new element.

XML中有5个预定义的实体引用: / p>

There are 5 pre-defined entity references in XML:



&lt;    <   less than
&gt;    >   greater than
&amp;   &   ampersand 
&apos;  '   apostrophe
&quot;  "   quotation mark

您可以使用以下方式验证您的XML:
http://www.w3schools.com/xml/xml_validator.asp

You can verify your XML with: http://www.w3schools.com/xml/xml_validator.asp

这篇关于不应将哪个字符设置为XML文件中的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆