为什么外部系统实体在 Chrome、IE 或 Netscape 中不适合我? [英] Why external system entities are not working for me in Chrome, IE or Netscape?

查看:9
本文介绍了为什么外部系统实体在 Chrome、IE 或 Netscape 中不适合我?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试复制此答案中给出的示例:

I am attempting to replicate the example given in this answer:

https://stackoverflow.com/a/5127928/356011

说明使用外部实体将 XML 文件的片段包含在另一个 XML 文件中.

that illustrates using external entities to include a fragment of XML file in another XML file.

doc.xml:

<?xml version="1.0" standalone="no" ?>
<!DOCTYPE doc [
        <!ENTITY otherFile SYSTEM "otherFile.xml">
        ]>
<doc>
    <foo>
        <bar>&otherFile;</bar>
    </foo>
</doc>

其他文件.xml:

<baz>this is my content</baz>

当我尝试通过在任何浏览器中打开 doc.xml 来测试它时,我会得到:

When I attempt to test this by opening doc.xml in any browser, I just get:

 <doc>
   <foo>
      <bar/>
    </foo>
 </doc>

渲染.

它不应该也渲染包含的文件吗?

Shouldn't it be rendering the included file, as well?

推荐答案

它不起作用的原因是浏览器不完全支持 XML.他们仅通过限制来支持它,例如没有外部实体".我不知道为什么.

The reason it isn't working is that browsers don't fully support XML. They only support it with restrictions, such as "no external entities". I don't know why.

这篇关于为什么外部系统实体在 Chrome、IE 或 Netscape 中不适合我?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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