XML中的特殊字符 [英] Special Characters in XML

查看:149
本文介绍了XML中的特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个使用xml和xsl的左侧导航系统。一切都进展顺利,直到我尝试在xml文档中使用特殊字符为止。我正在使用& raquo; 并出现错误。

I am creating a left navigation system utilizing xml and xsl. Everything was been going great until I tried to use a special character in my xml document. I am using » and I get th error.


原因:引用未定义实体'raquo'。

错误代码:-1072898046

reason: Reference to undefined entity 'raquo'.
error code: -1072898046

我如何进行这项工作?

How do I make this work?

推荐答案

您正尝试使用 HTML实体。这些实体在文档的文档类型定义(DTD)中声明。

You are trying to use an HTML entity in a non-HTML or non-XHTML document. These entities are declared in the document's Document Type Definition (DTD).

您应该使用实体引用的数字Unicode版本。例如,对于& raquo; ,您应使用»

You should use the numerical Unicode version of the entity reference. For example, in the case of » you should use »

或者,您可以在XML文档的DTD中定义它们

<!ENTITY entity-name "entity-value">
<!ENTITY raquo "&#187;">

否则,如果您的文档是UTF-8,我相信您可以直接在其中使用实际字符您的XML文档。

Otherwise, if your document is UTF-8, I believe you can just use the actual character directly in your XML document.

»

这篇关于XML中的特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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