&o急性;在 xml 文件中不允许,但在 .net 资源文件中允许?

发布于 2024-10-11 09:05:25 字数 316 浏览 5 评论 0原文

我正在解析一些 .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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夜光 2024-10-18 09:05:25

ó 是一个命名的 HTML 实体,没有在 XML 中定义。

XML 仅定义命名 HTML 实体的子集(即 &'"><(如果没记错的话)。

您可以使用数字实体表示形式:

información

或者,以十六进制表示:

información

ó 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:

información

Or, in hexadecimal:

información
我乃一代侩神 2024-10-18 09:05:25

默认情况下,不为 XML 声明实体 oacute。请尝试使用 ó 代替。 这里是 HTML 实体及其相应代码的列表,以防您遇到其他类似问题。

如果您希望继续使用 ó,您可以自己定义实体。

如果您使用 DTD,则可以这样定义它

<!ENTITY oacute "ó">

;如果使用 Schema,则可以这样定义:

<xsd:element name="oacute" type="xsd:token" fixed="ó"/>

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

<!ENTITY oacute "ó">

Or if using Schema, thus:

<xsd:element name="oacute" type="xsd:token" fixed="ó"/>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文