XML文件无法读取外部CSS或DTD
因此,我使用Notepad ++,我有一个非常简单的XML文件来证明问题。
<?xml version="1.0" standalone="no"?>
<?xml-stylesheet type="text/css" href="stylesheetfamily.css"?>
<family>
<parent>Judy</parent>
<parent>Layard</parent>
<child>Jennifer</child>
<child>Brendan</child>
</family>
外部CSS就是这样:
family ( color: #8B008B; )
parent (
font-family: Arial Black;
display: block;
color: #ff0000;
border: solid 5px green;
width: 300px;
text-align: center;
)
child (
font-family: verdana, helvetica;
color: #cc0000;
border: solid 5px;
border-color: #cc0000;
display: block;
)
如果我在浏览器上运行XML文件进行检查,我将不会得到等待结果。它将显示XML,但不读取CSS文件,只是常规文本。如果我在浏览器上打开DEV控制台,我将获得“样式”选项卡,无匹配的选择器或样式。 即使我使用外部DTD(而不是CSS),XML文件也会向我展示DTD被禁止,即使DTD有效,也没有首先读取DTD文件。
So Im using notepad++ and i have a really simple xml file for demonstrating the problem.
<?xml version="1.0" standalone="no"?>
<?xml-stylesheet type="text/css" href="stylesheetfamily.css"?>
<family>
<parent>Judy</parent>
<parent>Layard</parent>
<child>Jennifer</child>
<child>Brendan</child>
</family>
and the external css is this:
family ( color: #8B008B; )
parent (
font-family: Arial Black;
display: block;
color: #ff0000;
border: solid 5px green;
width: 300px;
text-align: center;
)
child (
font-family: verdana, helvetica;
color: #cc0000;
border: solid 5px;
border-color: #cc0000;
display: block;
)
If i run the xml file on browser to check it, i wont get the awaiting result. It will show the xml but without reading css file just regular text. If i open the dev console on browser i'll get on styles tab no matching selector or style.
Even if i use an external dtd (instead of css) the xml file will show me that DTD is Prohibited, even though the dtd is valid so propably it didnt read the dtd file in first place.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您在样式表中使用了括号(),而不是卷曲括号{}。
You used parenthesis () instead of curly braces {} in your stylesheet.