Closed Bug 194176 Opened 22 years ago Closed 3 years ago

document.load should parse as XML regardless of mime type

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: karoline.kirmse, Assigned: hjtoi-bugzilla)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3b) Gecko/20030210
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3b) Gecko/20030210

I import with the following script a xml or rdf or xhtml file.

xmlDoc = document.implementation.createDocument("", "", null);
xmlDoc.onload = init;
xmlDoc.load("eg-00.xhtml");

function init(){
var xmlSeri=new XMLSerializer();
alert(xmlSeri.serializeToString(xmlDoc));}

The Problem is the following:
do I call a xml-file its working fine (really good)
do I call a rdf-file or xhtml-file (by calling the website local on my PC) it is
loaded perfectly
but (now the Problem) 
do I call the same site from the internet the script returns an empty string!

Reproducible: Always

Steps to Reproduce:
can you attach a testcase ?
can you post Talkback ID for this crash "mozilla/bin/components/talkback.exe" ?
Severity: normal → critical
Keywords: crash, stackwanted
try that one as another testcase, you can also try it with IE

http://ipsi.fhg.de/~kirmse/Testarea/testcase/tester.html
removing crash keyw as it doesn't actually crash Moz.
Severity: critical → normal
Keywords: crash, stackwanted
document.load -- to heikki

I bet the problem is that the XHTML and RDF document just don't have an XML MIME
type (both are text/plain).
Assignee: jst → heikki
Status: UNCONFIRMED → NEW
Ever confirmed: true
Yes, the problem is that the server returns text/plain for files with .xhtml and
.rdf suffix, and therefore Mozilla will not even try to parse them as XML. So,
you can fix your samples by making sure the server sends the correct XML mime type.

However, I think Mozilla might actually be against the DOM Level 3 spec (still
draft) here. Load & Save defines here:

http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DOMBuilder

(see "supported-mediatypes-only") that the default is: "Don't check the media
type, accept any type of data." I read this as: parse as XML regardless of the
media type. Someone correct me if I am wrong.
No, you're right.  That's what the LS spec calls for.
Let's see if I can fix it for 1.4alpha.
Summary: importing a rdf or xhtml document via document.implementation.createDocument crashed → document.load should parse as XML regardless of mime type
Target Milestone: --- → mozilla1.4alpha
It'd be great to be able to tell the syncloader to override the mimetype.
Documents loaded with the XSLT document() function need to ignore the mimetype too.
Um, hasn't there been some controversy in the TAG over whether specs 
should be allowed to do things like this (instruct overriding of HTTP 
Content-Type)?
Target Milestone: mozilla1.4alpha → mozilla1.4beta
*** Bug 137240 has been marked as a duplicate of this bug. ***
Target Milestone: mozilla1.4beta → ---
Component: DOM: Core → DOM: Core & HTML
QA Contact: desale → general

document.load() was removed.

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.