&o急性;在 xml 文件中不允许,但在 .net 资源文件中允许?
我正在解析一些 .net 资源文件 (.resx)。
其中,我有这段数据:
información
这在我的 .net 应用程序中有效,但是当我尝试在我的 xml 文档中加载此文件时,
XDocument xmlDoc = XDocument.Parse(s);
我收到此错误:
Reference to undeclared entity 'oacute'.
这是为什么?
i'm parsing a few .net resource files (.resx).
In that, i have this piece of data:
información
This works in my .net app, but when i try to load this file in my xml document
XDocument xmlDoc = XDocument.Parse(s);
i get this error:
Reference to undeclared entity 'oacute'.
Why is that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ó
是一个命名的 HTML 实体,没有在 XML 中定义。XML 仅定义命名 HTML 实体的子集(即
&
、'
、"
、>
和<
(如果没记错的话)。您可以使用数字实体表示形式:
或者,以十六进制表示:
ó
is a named HTML entity that is not defined in XML.XML only defines a subset of the named HTML entities (namely
&
,'
,"
,>
and<
if memory serves).You can use the numeric entity representation instead:
Or, in hexadecimal:
默认情况下,不为 XML 声明实体 oacute。请尝试使用
ó
代替。 这里是 HTML 实体及其相应代码的列表,以防您遇到其他类似问题。如果您希望继续使用
ó
,您可以自己定义实体。如果您使用 DTD,则可以这样定义它
;如果使用 Schema,则可以这样定义:
The entity oacute is not declared by default for XML. Try
ó
instead. Here is a list of HTML entities with their corresponding codes, in case you have other similar problems.If you'd prefer to continue using
ó
, you can define the entity yourself.If you are using a DTD, you can define it thus
Or if using Schema, thus: