Serving OL maps through eXist
Posted by gregster on 25 Feb 2013 in Activity log, Documentation
After a bit of experimentation I've discovered that serializing documents that include OpenLayers maps need to be served as text/html. I was serializing may pages as application/xhtml+xml and I got javascript errors like:
Uncaught TypeError: Object #<Document> has no method 'write'
So, for OL pages, use this serialization option:
declare option exist:serialize "method=html5 media-type=text/html encoding=utf-8 indent=yes";
The obvious problem with serving as text/html is that, according to the spec:
The 'text/html' media type [RFC2854] is primarily for HTML, not for XHTML. In general, this media type is NOT suitable for XHTML except when the XHTML is conforms to the guidelines in Appendix A. In particular, 'text/html' is NOT suitable for XHTML Family document types that add elements and attributes from foreign namespaces, such as XHTML+MathML [XHTML+MathML].
According to the spec, then, if one wants to use something like SVG directly in the document, you may not be able to on pages like this. Using SVG graphics in CSS seems to be OK, though.
I'm not yet sure what impact this will have on OL maps that include SVG via JS.