XHR and responseXML == null why ?

V

VK

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

Bjoern Hoehrmann

* 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.
 
M

Martin Honnen

Une said:
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/XMLHttpRequest#overrideMimeType.28.29

But IE/MSXML does not provide that method.
 
T

Thomas 'PointedEars' Lahn

VK said:
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/media-types/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
 
V

VK

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
 
U

Une Bévue

VK said:
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.xhtml> on
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]
 
T

Thomas 'PointedEars' Lahn

VK said:
Bad breakfast again?


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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top