由于编码字符导致 XSLT 抛出错误 [英] XSLT throwing error due to encoded characters

查看:36
本文介绍了由于编码字符导致 XSLT 抛出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用外部实体引用ISOEntities";在我的特殊字符的 XML 文件中,但它没有包含在文件中,并且由于编码的特殊字符,XML 出现错误.

I am using an external entity reference "ISOEntities" in my XML file for special characters but it is not getting included in the file and XML is giving an error due to encoded special characters.

<?xml version="1.0" encoding="UTF-16"?>

<!DOCTYPE root[
<!ENTITY % ISOEntities PUBLIC "ISO 8879-1986//ENTITIES ISO Character Entities 20030531//EN//XML" "http://www.s1000d.org/S1000D_4-0-1/ent/ISOEntities">
%ISOEntities;
]>
<root>
<description> This is description &amp;</description>
</root>
```
I am using the following XSLT for display:
```
<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<html>
<body>
  <xsl:template match="/">
    <h1>Description:<xsl:value-of select="root/description" disable-output-escaping="yes"/></h1>
  </xsl:template>

 </body>
</html>

</xsl:stylesheet>

Am I parsing the encoded character node properly?

Could you please suggest what could be the problem with the XSLT code as it is not displaying anything when an encoded special character is there in the XML node?

Thank you very much for your support and time.

Regards,
AK

推荐答案

您需要详细说明您正在使用什么 XML 解析器,以及您如何调用它.

You need to give details of what XML parser you are using, and how you are invoking it.

世界已经变得对安全很着迷,现在许多解析器默认关闭外部实体扩展,即使有一个应该完全安全的公共 ID.相当多的解析器完全忽略了 DTD.

The world has become security-obsessed, and many parsers these days switch off external entity expansion by default, even when there is a public ID which should be totally secure. Quite a few parsers ignore DTDs entirely.

这篇关于由于编码字符导致 XSLT 抛出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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