By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,034 Members | 971 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,034 IT Pros & Developers. It's quick & easy.

XHR and responseXML == null why ?

P: n/a
I have a page here :
<http://thoraval.yvon.free.fr/Fixed_layout/import_nodes.xhtml>
where i import nodes using XMLHttpRequest.

it's ok when importing an SVG file (click on "Actions" + "Import SVG")
but i get req.responseXML === null when trying to import a MathMl file
why ?

the file bernoulli.nml is ther...

--
Une Bévue
Jun 27 '08 #1
Share this Question
Share on Google+
8 Replies


P: n/a
VK
On Apr 26, 6:16 pm, unbewusst.s...@weltanschauung.com.invalid (Une
Bévue) wrote:
I have a page here :
<http://thoraval.yvon.free.fr/Fixed_layout/import_nodes.xhtml>
where i import nodes using XMLHttpRequest.

it's ok when importing an SVG file (click on "Actions" + "Import SVG")
but i get req.responseXML === null when trying to import a MathMl file
why ?
Because MathML is application/xhtml+xml, not text/plain

Either serve the MathML file with the proper Content-type, or use
XHR.overrideMimeType('application/xhtml+xml') before sending request.
Jun 27 '08 #2

P: n/a
* Une Bévue wrote in comp.lang.javascript:
>I have a page here :
<http://thoraval.yvon.free.fr/Fixed_layout/import_nodes.xhtml>
where i import nodes using XMLHttpRequest.

it's ok when importing an SVG file (click on "Actions" + "Import SVG")
but i get req.responseXML === null when trying to import a MathMl file
why ?

the file bernoulli.nml is ther...
% http-head http://thoraval.yvon.free.fr/Fixed_layout/bernoulli.nml
HTTP/1.1 200 OK
Date: Sat, 26 Apr 2008 14:35:52 GMT
Server: Apache/ProXad [Jan 10 2008 05:02:06]
Last-Modified: Sat, 26 Apr 2008 12:41:39 GMT
ETag: "169d386-85e-48132303"
Connection: close
Accept-Ranges: bytes
Content-Length: 2142
Content-Type: text/plain

You have to change your server configuration so that the document is
delivered as application/xml or a compatible MIME Type. Renaming it to
..xml might also work as a last resort.
--
Björn Höhrmann · mailto:bj****@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Jun 27 '08 #3

P: n/a
Une Bévue wrote:
I have a page here :
<http://thoraval.yvon.free.fr/Fixed_layout/import_nodes.xhtml>
where i import nodes using XMLHttpRequest.

it's ok when importing an SVG file (click on "Actions" + "Import SVG")
but i get req.responseXML === null when trying to import a MathMl file
why ?

the file bernoulli.nml is ther...
Make sure the XML documents you want to load with responseXML of
XMLHttpRequest are served as application/xml or text/xml.
Or use the overrideMimeType method of XMLHttpRequest
http://developer.mozilla.org/en/docs...MimeType.28.29

But IE/MSXML does not provide that method.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jun 27 '08 #4

P: n/a
Martin Honnen <ma*******@yahoo.dewrote:
Make sure the XML documents you want to load with responseXML of
XMLHttpRequest are served as application/xml or text/xml.
Or use the overrideMimeType method of XMLHttpRequest
http://developer.mozilla.org/en/docs...MimeType.28.29

But IE/MSXML does not provide that method.
Fine thanks, to all of U, i had only to change file extension :

bernoulli.nml -bernoulli.xml !!!
--
Une Bévue
Jun 27 '08 #5

P: n/a
VK wrote:
On Apr 26, 6:16 pm, unbewusst.s...@weltanschauung.com.invalid (Une
Bévue) wrote:
>I have a page here :
<http://thoraval.yvon.free.fr/Fixed_layout/import_nodes.xhtml>
where i import nodes using XMLHttpRequest.

it's ok when importing an SVG file (click on "Actions" + "Import SVG")
but i get req.responseXML === null when trying to import a MathMl file
why ?

Because MathML is application/xhtml+xml, not text/plain
Nonsense.
Either serve the MathML file with the proper Content-type, or use
XHR.overrideMimeType('application/xhtml+xml') before sending request.
The proper media type for MathML, if there is such a thing, is text/xml or
application/xml, as it is an application of XML:

http://www.iana.org/assignments/medi...s/application/
http://www.iana.org/assignments/media-types/text/

The *recommended* media type for *an XHTML document that contains MathML
markup*, is application/xhtml+xml:

http://www.w3.org/TR/xhtml-media-types/
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Jun 27 '08 #6

P: n/a
VK
On Apr 28, 5:46 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
Because MathML is application/xhtml+xml, not text/plain

Nonsense.
Bad breakfast again?
The proper media type for MathML, if there is such a thing, is text/xml or
application/xml, as it is an application of XML:
There is not "proper" media type for MathML because by W3C dreams it
is intended to be used only as XHTML document fragments and not as
stay-alone documents. With XHTML recommended Content-type application/
xhtml+xml it is the first one to suggest then for MathML - not to say
it makes any difference from text/xml
Jun 27 '08 #7

P: n/a
VK <sc**********@yahoo.comwrote:
>
There is not "proper" media type for MathML because by W3C dreams it
is intended to be used only as XHTML document fragments and not as
stay-alone documents. With XHTML recommended Content-type application/
xhtml+xml it is the first one to suggest then for MathML - not to say
it makes any difference from text/xml
Finally, i've added :
AddType application/xhtml+xml .mml

in my .htaccess and it works great with MathML (mml sufix) even with
entities...(DOCTYPE defined in the mml file)

see <http://thoraval.yvon.free.fr/Fixed_layout/import_nodes.xhtmlon
Mac OS X 10.4.11 works with :
Firefox 2 : OK with MathML entities, poor result with svg (no animation)
Opera latest : MathML entities not translated, best svg.

click Action + [import SVG | MathML]

--
Une Bévue
Jun 27 '08 #8

P: n/a
VK wrote:
On Apr 28, 5:46 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
>>Because MathML is application/xhtml+xml, not text/plain
Nonsense.

Bad breakfast again?
>The proper media type for MathML, if there is such a thing, is text/xml or
application/xml, as it is an application of XML:

There is not "proper" media type for MathML
Yes, there is, with the provision that I named above.
because by W3C dreams it is intended to be used only as XHTML document
fragments and not as stay-alone documents.
Nonsense.
With XHTML recommended Content-type application/xhtml+xml it is the first
one to suggest then for MathML - not to say it makes any difference from text/xml
The OP is obviously trying to retrieve a standalone MathML document resource
via XHR, so the MIME media type declaration of the response should contain
an XML media type, not an XHTML media type.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>
Jun 27 '08 #9

This discussion thread is closed

Replies have been disabled for this discussion.