It's impossible to load RDF files if they don't have the extension ".rdf"

NEW

Status

()

Core
RDF
15 years ago
11 months ago

People

(Reporter: Manuel Reimer, Assigned: Robert John Churchill)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

776 bytes, application/x-zip-compressed
Details
(Reporter)

Description

15 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; de-AT; rv:1.7a) Gecko/20040219
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; de-AT; rv:1.7a) Gecko/20040219

It's possible to write RDF-files without the extension ".rdf" without problems
(it's possible to create datasources for empty or not existing files which don't
have the extension ".rdf"). As soon as I want to get an datasource for an
RDF-file without the ".rdf" extension, which contains data, I get the following
error in javascript console:


Fehler: uncaught exception: [Exception... "Component returned failure code:
0x804e03f3 [nsIRDFService.GetDataSourceBlocking]"  nsresult: "0x804e03f3
(<unknown>)"  location: "JS frame :: chrome://test/content/test.js :: testload
:: line 4"  data: no]


Why can I write RDF-files with (for example) the extension ".dat" but can't open
the data I've written? I don't see any reason for the limitation to this one
extension.

Reproducible: Always
Steps to Reproduce:
1. Unzip the attached zipfile
2. edit the file-URL in the test code to the path where you've extracted the RDF
file to.
3. Run the test code
4. Now you'll get an alert which displays the one item saved in the test RDF
5. rename the test.rdf to test.dat and change the file URL to the new file
6. Run test code again

Actual Results:  
I get an error "<unknown>" in javascript console

Expected Results:  
The RDF service should load the file without throwing this error.
(Reporter)

Comment 1

15 years ago
Created attachment 144131 [details]
test code
The RDFXMLDataSource just feeds the data to the parser, which is left to guess
how to parse it.  So the parser looks at the MIME type of the data, which it
ends up having to get from the extension.

Shouldn't the RDFXMLDataSource explicitly set the type hint on the channel
(prior to calling Open())?  See
http://lxr.mozilla.org/seamonkey/source/netwerk/base/public/nsIChannel.idl#112

Updated

15 years ago
Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 3

15 years ago
Since we want to implement further serialisations of RDF, like N-Triples, there 
is no real way to say that we want to have XML/RDF.
That this is ok for creating files comes from the fact that that throws an
NS_ERROR_FILE_NOT_FOUND very early in the game, and we never try to get the 
mimetype for that.
I'm not really sure why the content sniffing doesn't get us text/xml though.
OS: Windows 2000 → All
Hardware: PC → All
QA Contact: rdf
You need to log in before you can comment on or make changes to this bug.