473,804 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reading RSS XML with IE

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.XMLDO M");
to load the rss. Is this where the problem lies?

(Using document.implem entation.create Document with FF reads the XML
correctly with or without a DOCTYPE.)

Andrew Poulos
Jan 14 '06 #1
28 2200


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.XMLDO M");
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.resoveExter nals = false
doc.validateOnP arse = 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/
Jan 14 '06 #2
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.XMLDO M");
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.resoveExter nals = false
doc.validateOnP arse = 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
Jan 14 '06 #3
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.XMLDO M");
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.resoveExter nals = false
doc.validateOnP arse = 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
Jan 15 '06 #4
Andrew Poulos wrote:
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.


Yes, it means the XML is invalid.

The XML contains a DTD embedded inline in the document, but the DTD only
defines some entities & not any elements, so the document will fail to
validate. If you can turn off validation, or tell the parser to ignore the
inline DTD you may be handle it.

The simplest thing is probably to set the 'validateOnPars e' attribute to
false although this could hide more serious errors.
Jan 15 '06 #5
VK

Duncan Booth wrote:
Andrew Poulos wrote:
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.


Yes, it means the XML is invalid.

The XML contains a DTD embedded inline in the document, but the DTD only
defines some entities & not any elements, so the document will fail to
validate. If you can turn off validation, or tell the parser to ignore the
inline DTD you may be handle it.


Did you try (IE-only):

<html>
<head>
<title>Untitl ed Document</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
</head>

<body onload="alert(d ocument.scripts[0])">
<script type="text/xml"
src="http://www.nasa.gov/rss/image_of_the_da y.rss"></script>
</body>
</html>

That works just fine (means no parsing errors).

Jan 15 '06 #6
VK wrote:
Duncan Booth wrote:
Andrew Poulos wrote:
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.

Yes, it means the XML is invalid.

The XML contains a DTD embedded inline in the document, but the DTD only
defines some entities & not any elements, so the document will fail to
validate. If you can turn off validation, or tell the parser to ignore the
inline DTD you may be handle it.


Did you try (IE-only):

<html>
<head>
<title>Untitl ed Document</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
</head>

<body onload="alert(d ocument.scripts[0])">
<script type="text/xml"
src="http://www.nasa.gov/rss/image_of_the_da y.rss"></script>
</body>
</html>

That works just fine (means no parsing errors).

I'm not sure what you're doing. How would I access nodes etc?

I'm using the activeX object to load the XML file so that I can later
walk it's DOM. I agree with Duncan Booth that the DTD fails to define
any ELEMENTS and so the XML is invalid.

Andrew Poulos
Jan 15 '06 #7


Andrew Poulos wrote:

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."


As already suggested you can set
xmlDocument.val idateOnParse = false;
before calling the load method and that way you can ensure that the DOM
is built if the XML is well-formed without being valid.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 15 '06 #8
Martin Honnen wrote:

Andrew Poulos wrote:
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."


As already suggested you can set
xmlDocument.val idateOnParse = false;
before calling the load method and that way you can ensure that the DOM
is built if the XML is well-formed without being valid.


I used parseError.reas on to show me what was wrong with the sample RSS
XML I was testing and I didn't understand what this "new" error meant on
"real" RSS. I think I'll try to read the XML twice. If it fails trying
to validate the XML I'll try it without validating.

thanks
Andrew Poulos
Jan 15 '06 #9
VK

Andrew Poulos wrote:

<html>
<head>
<title>Untitl ed Document</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
</head>

<body onload="alert(d ocument.scripts[0])">
<script type="text/xml"
src="http://www.nasa.gov/rss/image_of_the_da y.rss"></script>
</body>
</html>
I'm not sure what you're doing. How would I access nodes etc?
It is called "Dynamic Data Island" and it implants dynamic XML data
source into document. You're accessing data later (after script.onload)
using document.script s[i].XMLDocument + standard XML DOM methods.

Nevertheless it fails on the data source in question
"image_of_the_d ay.rss" for the same reason why responseXML is not set
simetimes: because RSS feed is *not* XML though it uses XML format. Its
MIME (if served properly) should be say "applicatio n/rss+xml" or other
(depending on what rss format is used: RSS, Atom). In any case nothing
similar to the needed "text/xml" as you can see. You need to have a
registered MIME in your browser (comes with installed RSS readers). Or
you have to read it as plain vanilla text and parse it manually - or
feed it manually to browser's XML parser.
DTD fails to define
any ELEMENTS and so the XML is invalid.


This sentence has no meaning for my humble mind. XML by definition can
consist of any proprietary nodes, as long as they paired properly. I
can use:
<foobar>
<foo>Foo</foo>
<bar>Bar</bar>
</foobar>

w/o any DTD "permission s" to use <foobar>, <foo>, <bar>

It fails because Content-Type doesn't match to the expected: "wants
text/xml, got application/rss+xml"

Jan 15 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2414
by: Raymond Hettinger | last post by:
Found in a pamphlet at a pre-school: --------------------------------------- Reading improves vocabulary Reading raises cultural literacy through shared knowledge Reading develops writing skills Reading opens the mind to new ways of understanding Reading is fun Accordingly, I suggest the following works of literature:
19
10387
by: Lionel B | last post by:
Greetings, I need to read (unformatted text) from stdin up to EOF into a char buffer; of course I cannot allocate my buffer until I know how much text is available, and I do not know how much text is available until I have read it... which seems to imply that multiple reads of the input stream will be inevitable. Now I can correctly find the number of characters available by: |
4
9847
by: Oliver Knoll | last post by:
According to my ANSI book, tmpfile() creates a file with wb+ mode (that is just writing, right?). How would one reopen it for reading? I got the following (which works): FILE *tmpFile = tmpfile(); /* write into tmpFile */ ...
9
5525
by: Mike Reed | last post by:
I must be having a "senile" day! I cannot recall, nor get to work, code to read a cookie's expiration date/time in an ASP page/VBScript. What am I missing? *** Sent via Developersdex http://www.developersdex.com ***
4
3269
by: Gaijinco | last post by:
I had a file named nap.in which looks like this: 4 10:00 12:00 Lectures 12:00 13:00 Lunch, like always. 13:00 15:00 Boring lectures... 15:30 17:45 Reading 4 10:00 12:00 Lectures 12:00 13:00 Lunch, just lunch.
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10359
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9177
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6870
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3837
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3005
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.