XML渲染问题 [英] XML Rendering Problem

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

问题描述




我正在使用xsl样式表转换xml页面。使用Firefox 1.0.7和IE

6.0.29在我的本地机器上测试结果

看起来很好,但在我将页面上传到我的服务器并检查它们之后

远程,页面无法在Firefox中呈现(在IE中工作正常)。

知道发生了什么事吗?


在firefox中,看起来xml页面的内容只是吐出来了,并且没有尝试渲染它(好像它不是

识别作为XML)。


xml页面:
http://angelforge.com/jamie/resume/resume.xml

xsl:
http://angelforge.com/jamie/resume/resume.xsl

css:
http://angelforge.com /jamie/resume/resume.css


js:
http://angelforge.com/jamie/resume /resumeFunctions.js

解决方案

ja ****** @ gmail.com 写道:

在firefox中,看起来xml页面的内容刚刚获得
吐出,并没有尝试渲染它(好像它没有被识别为XML)。
http://angelforge.com/jamie/resume/resume.xml




200 OK

连接:关闭

日期:2006年2月16日星期四21:01:46 GMT

接受范围:字节

ETag:66c0c7-172d-43f4d9ad

服务器:Apache / 1.3.34(Unix)mod_throttle / 3.1.2 mod_auth_passthrough / 1.8

mod_log_bytes / 1.2 mod_bwlimited / 1.4 PHP / 4.3.11 FrontPage / 5.0.2.26 35

mod_ssl / 2.8.25 OpenSSL / 0.9.7a

内容长度:5933

内容类型:text / html<< ;< ============================================= !!

最后修改日期:2006年2月16日星期四19:59:41 GMT

客户日期:2006年2月16日星期四21:00:20 GMT

客户 - 同行:64.20.42.162:80

客户 - 响应 - 号码:1


您的服务器声称您的XML是HTML并且浏览器正在尝试

这样对待它。


-

David Dorward< http://blog.dorward .me.uk /> < http://dorward.me.uk/>

Home是〜/ .bashrc的位置


David Dorward写道:

ja******@gmail.com 写道:
< blockquote class =post_quotes>在firefox中,看起来xml页面的内容只是吐出来了,并没有尝试渲染它(就好像它没有被识别为XML一样) )。
http://angelforge.com/jamie/resume/ resume.xml



200 OK
连接:关闭
日期:2006年2月16日星期四21:01:46 GMT
接受-Ranges:bytes
ETag:" 66c0c7-172d-43f4d9ad"
服务器:Apache / 1.3.34(Unix)mod_throttle / 3.1.2 mod_auth_passthrough / 1.8
mod_log_bytes / 1.2 mod_bwlimited / 1.4 PHP / 4.3.11 FrontPage / 5.0.2.2635
mod_ssl / 2.8.25 OpenSSL / 0.9.7a
内容长度:5933
内容类型:text / html<<&l t; ============================================= !!
Last-Modified:2006年2月16日星期四19:59:41 GMT
客户日期:2006年2月16日星期四21:00:20 GMT
客户 - 同行:64.20.42.162:80
客户响应 - 数字:1

您的服务器声称您的XML是HTML,浏览器正在尝试将其视为处理。




正如David指出的那样,如果你希望浏览器将其视为XML,那么你需要这么说(FAQ: http://xml.silmaril.ie/developers/serversoftware/

但是它变得更糟:如果你把它作为XML提供,使用XSLT将它呈现为HTML / b $ b,浏览器仍将它视为XML,所以你不能使用Javascript

因为没有HTML可以悬挂它的爪子。如果您在浏览器中打开

XML文档,然后执行View | Source,您将看到

是XML:即使它已经呈现为HTML,影响

只有定位和格式化 - 底层代码仍然是

HTML,所以Javascript不起作用。


除非当然,有人想解释一下如何做到这一点(我已经要求人们将这些贡献给XML常见问题解答,但是有一些没有接受者的b / b
到目前为止,这就是为什么我假设它不起作用。我将* b $ b * * * *被证明是错误的 - 我不是Javascript人。)


/// Peter

-

XML FAQ: http://xml.silmaril.ie/


如果你看一下我在IE中发布的页面6.0.29,你会看到我的

javascript工作正常: http://angelforge.com/jamie/resume/resume.xml

(例如,点击Microsoft Excel,或点击取消按钮顶部

右)。我对Firefox不太确定。


Hi,

I am transforming an xml page using an xsl stylesheet. The results
look fine when tested on my local machine using Firefox 1.0.7 and IE
6.0.29, but after I upload the pages to my server and check them
remotely, the page fails to render in Firefox (it works fine in IE).
Any idea what is going on?

In firefox, it looks like the contents of the xml page are just getting
spit out, and no attempt is made to render it (as if it is not
recognized as XML).

xml page:
http://angelforge.com/jamie/resume/resume.xml

xsl:
http://angelforge.com/jamie/resume/resume.xsl

css:
http://angelforge.com/jamie/resume/resume.css

js:
http://angelforge.com/jamie/resume/resumeFunctions.js

解决方案

ja******@gmail.com wrote:

In firefox, it looks like the contents of the xml page are just getting
spit out, and no attempt is made to render it (as if it is not
recognized as XML).
http://angelforge.com/jamie/resume/resume.xml



200 OK
Connection: close
Date: Thu, 16 Feb 2006 21:01:46 GMT
Accept-Ranges: bytes
ETag: "66c0c7-172d-43f4d9ad"
Server: Apache/1.3.34 (Unix) mod_throttle/3.1.2 mod_auth_passthrough/1.8
mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.11 FrontPage/5.0.2.2635
mod_ssl/2.8.25 OpenSSL/0.9.7a
Content-Length: 5933
Content-Type: text/html <<<============================================= !!
Last-Modified: Thu, 16 Feb 2006 19:59:41 GMT
Client-Date: Thu, 16 Feb 2006 21:00:20 GMT
Client-Peer: 64.20.42.162:80
Client-Response-Num: 1

Your server is claiming that your XML is HTML and browsers are attempting to
treat it as such.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is


David Dorward wrote:

ja******@gmail.com wrote:

In firefox, it looks like the contents of the xml page are just getting
spit out, and no attempt is made to render it (as if it is not
recognized as XML).
http://angelforge.com/jamie/resume/resume.xml



200 OK
Connection: close
Date: Thu, 16 Feb 2006 21:01:46 GMT
Accept-Ranges: bytes
ETag: "66c0c7-172d-43f4d9ad"
Server: Apache/1.3.34 (Unix) mod_throttle/3.1.2 mod_auth_passthrough/1.8
mod_log_bytes/1.2 mod_bwlimited/1.4 PHP/4.3.11 FrontPage/5.0.2.2635
mod_ssl/2.8.25 OpenSSL/0.9.7a
Content-Length: 5933
Content-Type: text/html <<<============================================= !!
Last-Modified: Thu, 16 Feb 2006 19:59:41 GMT
Client-Date: Thu, 16 Feb 2006 21:00:20 GMT
Client-Peer: 64.20.42.162:80
Client-Response-Num: 1

Your server is claiming that your XML is HTML and browsers are attempting to
treat it as such.



As David points out, if you want the browser to treat it as XML, you
gotta say so (FAQ: http://xml.silmaril.ie/developers/serversoftware/)

But it gets worse: if you serve it as XML, using XSLT to render it as
HTML, the browser still treats it as XML, so you can''t use Javascript
because there is no HTML for it to hang its claws on. If you open the
XML document in a browser and then do a View|Source all you will see
is the XML: even though it has been rendered as HTML, that affects
only the positioning and formatting -- the underlying code is still
HTML, so the Javascript is inoperative.

Unless, of course, someone would like to explain how to do it (I''ve
been asking people to contribute this to the XML FAQ but there have
been no takers so far, which is why I''m assuming it doesn''t work. I
would *love* to be proved wrong -- I''m not a Javascript person.)

///Peter
--
XML FAQ: http://xml.silmaril.ie/


If you look at the page I posted in IE 6.0.29, you will see that my
javascript works fine: http://angelforge.com/jamie/resume/resume.xml
(for example, click on Microsoft Excel, or the Cancel button at the top
right). I am not so sure about Firefox.


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

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