用IE阅读RSS XML [英] Reading RSS XML with IE

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

问题描述

将rss源加载到Windows IE时,doc.childNodes.length总是

等于0.如果我手动删除<!DOCTYPE标签doc.childNodes.length

是正确的。


我正在使用

doc = new ActiveXObject(" Microsoft.XMLDOM");

加载rss。这是问题所在吗?


(使用带有FF的document.implementation.createDocument在有或没有DOCTYPE的情况下正确读取XML

。)


Andrew Poulos

解决方案




Andrew Poulos写道:

将rss提要加载到Windows IE时,doc.childNodes.length总是
等于0.如果我手动删除<!DOCTYPE标记doc.childNodes.length
是正确的。

我正在使用
doc = new ActiveXObject(" Microsoft.XMLDOM");
来加载rss。这是问题所在吗?




很难说,我们需要查看更多代码,无论是同步加载

还是异步加载。

使用的一些设置是

doc.resoveExternals = false

doc.validateOnParse = false

究竟是怎样的那样做!DOCTYPE声明看起来像? XML

对于声明的文档类型是否有效?

你有没有检查过

doc.parseError.errorCode

doc.parseError.reason

虽然Mozilla使用Expat非验证解析器忽略

externals资源IE使用MSXML和MSXML可以验证DTD 。

如果你想验证DTD,那么你需要检查

是否存在parseError。

-


Martin Honnen
http://JavaScript.FAQTs.com /


Martin Honnen写道:



Andrew Poulos写道:

将rss提要加载到Windows IE时,doc.childNodes.length总是
等于0.如果我手动删除<!DOCTYPE标记doc.childNodes.length
是正确的。

我正在使用
doc = new ActiveXObject(& Mic rosoft.XMLDOM");
加载rss。这是问题所在吗?



很难说,我们需要查看更多代码,无论是同步加载还是异步加载。
一些设置可以使用是
doc.resoveExternals = false
doc.validateOnParse = false
那究竟是怎么做的!DOCTYPE声明是什么样的? XML对于声明的文档类型是否有效?
您是否检查过doc.parseError.errorCode
doc.parseError.reason




检查错误原因。我将RSS源复制到我的硬盘上

我必须无意中编辑了标签名称。


Andrew Poulos


Andrew Poulos写道:

Martin Honnen写道:



Andrew Poulos写道:

将rss源加载到Windows IE时,doc.childNodes.length
总是等于0.如果我手动删除<!DOCTYPE标签
doc.childNodes.length是正确的。

我正在使用
doc = new ActiveXObject(" Microsoft.XMLDOM");
来加载rss。这是问题所在吗?



很难说,我们需要查看更多代码,无论是同步加载还是异步加载。
一些设置可以使用是
doc.resoveExternals = false
doc.validateOnParse = false
那究竟是怎么做的!DOCTYPE声明是什么样的? XML对于声明的文档类型是否有效?
您是否检查过doc.parseError.errorCode
doc.parseError.reason


<检查错误原因是否成功。我将RSS提要复制到我的硬盘
我必须无意中编辑了标签名称。




我说得太早了。我尝试从这个链接解析RSS:

< url: http://www.nasa.gov/rss/image_of_the_day.rss >

但IE告诉我使用元素''rss''但不是在

DTD / Schema中声明。


这对我来说似乎很奇怪。这是否意味着XML本身无效或者b
有一些我无法访问的资源导致了

问题。


Andrew Poulos


When loading an rss feed into Windows IE, doc.childNodes.length always
equals 0. If I manually delete the <!DOCTYPE tag doc.childNodes.length
is correct.

I''m using
doc = new ActiveXObject("Microsoft.XMLDOM");
to load the rss. Is this where the problem lies?

(Using document.implementation.createDocument with FF reads the XML
correctly with or without a DOCTYPE.)

Andrew Poulos

解决方案



Andrew Poulos wrote:

When loading an rss feed into Windows IE, doc.childNodes.length always
equals 0. If I manually delete the <!DOCTYPE tag doc.childNodes.length
is correct.

I''m using
doc = new ActiveXObject("Microsoft.XMLDOM");
to load the rss. Is this where the problem lies?



Hard to tell, we need to see more code, whether you load synchronously
or asynchronously.
Some settings to play with are
doc.resoveExternals = false
doc.validateOnParse = false
And how exactly does that !DOCTYPE declaration look like? Is the XML
valid in regard to that declared document type?
Have you checked
doc.parseError.errorCode
doc.parseError.reason

While Mozilla uses with Expat a non validating parser that ignores
externals resources IE uses MSXML and MSXML can validate against a DTD.
If you want to validate against the DTD then you need to check whether
there is a parseError.
--

Martin Honnen
http://JavaScript.FAQTs.com/


Martin Honnen wrote:



Andrew Poulos wrote:

When loading an rss feed into Windows IE, doc.childNodes.length always
equals 0. If I manually delete the <!DOCTYPE tag doc.childNodes.length
is correct.

I''m using
doc = new ActiveXObject("Microsoft.XMLDOM");
to load the rss. Is this where the problem lies?



Hard to tell, we need to see more code, whether you load synchronously
or asynchronously.
Some settings to play with are
doc.resoveExternals = false
doc.validateOnParse = false
And how exactly does that !DOCTYPE declaration look like? Is the XML
valid in regard to that declared document type?
Have you checked
doc.parseError.errorCode
doc.parseError.reason



Checking the error reason did it. I copied the RSS feed to my hard drive
and I must''ve inadvertently edited a tag name.

Andrew Poulos


Andrew Poulos wrote:

Martin Honnen wrote:



Andrew Poulos wrote:

When loading an rss feed into Windows IE, doc.childNodes.length
always equals 0. If I manually delete the <!DOCTYPE tag
doc.childNodes.length is correct.

I''m using
doc = new ActiveXObject("Microsoft.XMLDOM");
to load the rss. Is this where the problem lies?



Hard to tell, we need to see more code, whether you load synchronously
or asynchronously.
Some settings to play with are
doc.resoveExternals = false
doc.validateOnParse = false
And how exactly does that !DOCTYPE declaration look like? Is the XML
valid in regard to that declared document type?
Have you checked
doc.parseError.errorCode
doc.parseError.reason



Checking the error reason did it. I copied the RSS feed to my hard drive
and I must''ve inadvertently edited a tag name.



I spoke too soon. I tried parsing the RSS from this link:
<url: http://www.nasa.gov/rss/image_of_the_day.rss >
but IE tells me that "The element ''rss'' is used but not declared in the
DTD/Schema."

This seems odd to me. Does this mean that the XML itself is invalid or
that there''s some resource that I don''t access to that is causing the
problem.

Andrew Poulos


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

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