Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider making MapML an extension to HTML #70

Closed
zcorpan opened this issue Jun 29, 2020 · 16 comments
Closed

Consider making MapML an extension to HTML #70

zcorpan opened this issue Jun 29, 2020 · 16 comments
Assignees

Comments

@zcorpan
Copy link

zcorpan commented Jun 29, 2020

A MapML document is a [MicroXML] document. As such, it MUST have a single root element named . It MUST NOT have a DOCTYPE declaration; attributes named 'xmlns' and names containing a colon character ':' (U+003A) are not permitted. Other restrictions relative to XML syntax are enumerated in [MicroXML].

Meanwhile, in the map element proposal, for the layer element, says:

If the src attribute is present: Empty. If no src attribute is present: Metadata content describing nested Map Markup Language content

MapML can't be MicroXML and also be embeddable in HTML (without significantly changing the HTML parser).

MicroXML implies that MapML elements are in no namespace. Apart from RSS, languages that browsers support use namespaces.

Changing the HTML parser to support a new class of foreign content seems unlikely to happen for MapML, or even for anything. Even minor changes are usually met with resistance from implementers, due to security concerns.

With https://github.com/prushforth/htmlparser and https://www.w3.org/community/maps4html/2019/12/09/the-design-of-mapml/ , I've understood that the intent is to change MapML to be more "like HTML", instead of MicroXML.

If so, that should be formalized in the MapML spec. Further, if the intent is to be able to embed MapML inline in HTML documents, I think the best way to do that is to make all MapML elements be HTML elements directly, and MapML documents be HTML documents. (XML serialization is still possible, like with HTML.)

The implications would be:

  • Maybe use text/mapml+html as the MIME type, if MapML needs its own MIME type. Otherwise use text/html.
  • Doctype should be <!doctype html> (or maybe allow omitting it for new MIME type)
  • Root element should be html, containing head and body.
  • Interfaces for elements should be HTMLElement, or HTMLExtentElement : HTMLElement etc.
  • Audit each MapML element if it can reuse an existing HTML element name:
    • head, title, base, meta: these don't seem to have MapML-specific processing. Remove from the MapML spec.
    • link: ?
    • extent: if this is intended to reuse form submission, maybe use form instead? (I'm not sure why MapML needs form submission?)
    • input: this doesn't seem to be a widget that expects user input; suggest minting a new element name.
    • datalist, label, select, option: ?
    • image: the HTML parser treats <image> as a macro and changes it to <img>. New element name?
    • feature, properties: don't clash with anything, but are a bit generic
    • geometry: doesn't clash, though this seems to be yet another way to represent 2d geometric shapes on the web. We have SVG, <area>, canvas 2dcontext API, Geometry APIs. This seems most like <area>, except it's only geometry data without hyperlink.
    • coordinates: why is this an element, and not an attribute of geometry?
@prushforth
Copy link
Member

Changing the HTML parser to support a new class of foreign content seems unlikely to happen for MapML, or even for anything. Even minor changes are usually met with resistance from implementers, due to security concerns.

I don't have enough experience in this domain to understand the security concerns, but it seems that some level of change must be ongoing as the vocabulary changes. I hope that minor changes can be accomplished for maps as a high-level feature in a single (group of) changes.

I've understood that the intent is to change MapML to be more "like HTML", instead of MicroXML.

Yes, the intent has always been to achieve maximum compatibility with HTML. My understanding of this compatibility has evolved over the course of this project, to the degree that I now believe MapML may be a good marketing term (YMMV), but it should actually be part of HTML, so that it comes with a DOM API that allows it to be programmed by Web devs, when included inline in HTML. I appreciate that this may cause confusion to a reader such as yourself, and I'll work towards removing that confusion for developers who follow you.

If so, that should be formalized in the MapML spec. Further, if the intent is to be able to embed MapML inline in HTML documents, I think the best way to do that is to make all MapML elements be HTML elements directly, and MapML documents be HTML documents. (XML serialization is still possible, like with HTML.)

Agreed.

Maybe use text/mapml+html as the MIME type, if MapML needs its own MIME type. Otherwise use text/html

OK. We haven't registered a MIME type yet. We will have to update the spec and the polyfill, as well as the servers (GeoServer, MapServer) that will support maps in HTML. I believe the use of text/mapml+html may involve a more elaborate registration. Unless I'm mistaken, which is my specialty, actually, +html suffix will need to be registered first, and may be starting a new suffix, akin to +json etc.

I believe it does require it's own MIME type, so that browsers know what to do with it when the context isn't fetching a layer in a map. i.e. it might be possible to synthesize a surrounding html, head, body, map and layer as it does with an image file.

Even when the context is fetching a layer within a map, it might even be useful to render text/html even on the map, if the rendering mode was by coordinate-specific means vs normal html rendering. We should discuss this more, but I think it could be a valuable general situation / use case.

Doctype should be <!doctype html>

OK, I worry a bit that we are relying too much on the MIME type if we don't have a <!doctype mapml> or root mapml element, but maybe that is misplaced concern, as I don't fully understand what these <!doctype html> and root html are used for.

(or maybe allow omitting it for new MIME type)

Yes. Again I'm a little fuzzy about the implication of not having a doctype and relying solely on the MIME type.

Root element should be html, containing head and body.

Yes. In HTML, I believe html, head and body are optional, supplied by the parser if not present.

Interfaces for elements should be HTMLElement, or HTMLExtentElement : HTMLElement etc.

Does this need to be specified in the MapML specification/proposal? I think yes, but not sure.

Audit each MapML element if it can reuse an existing HTML element name

Yes, agreed.

  • head, title, base, meta: these don't seem to have MapML-specific processing. Remove from the MapML spec.

OK. What about specifying the meta values that we need? Where should those go?

link: ?

We have a few requirements around link, some of which seem to fit in with how link is used generally, others which may be more surprising. Lots to discuss, I guess :-)

  • extent: if this is intended to reuse form submission, maybe use form instead?

We started out using extent like a form, but the submission model of a form is not similar enough to that of maps, so we ended up removing / deprecating the extent@action method of content retrieval, because template-based (link@tref) content retrieval paves the cowpath of how Web maps work today in script libraries. I will ensure that extent@action is completely removed from the spec, as I think it was an early mistake.

(I'm not sure why MapML needs form submission?)

Someday, not today, it would be cool to be able to use the map as an input method for forms, enabling declarative geospatial content creation, e.g.

<input type=location subtype=linestring ...>

  • input: this doesn't seem to be a widget that expects user input; suggest minting a new element name.

Was trying to re-use related stuff from HTML. The user input is gestures for zoom/pan events (move, moveend) however I can see why you think it should be something else.

  • datalist, label, select, option: ?

These probably require a demo to show what they are proposed to do for maps. They are mostly used to populate the layer control entry for the layer with values that control the requests that are made to a map or tile server, for example to allow the user to view the map layer at a particular date, or elevation, or for example to view highways only from a roads layer. Maybe when you see how these are used to control the content of the map, using input won't seem so odd?

  • image: the HTML parser treats <image> as a macro and changes it to <img>. New element name?

Maybe img? Map images aren't that different from regular images, and instead of extending the set of elements we apply the same re-use of existing semantics but update the rendering model?

  • feature, properties: don't clash with anything, but are a bit generic

These come from GeoJSON, but I was thinking recently that location instead of feature might be more consistent with the input@type=location. The Simple Features model is a very solid standard, and it's on this model that GeoJSON, KML, GML, Shapefiles and pretty much every spatial database format is based these days. So that's where I got the word feature from. I think it's based on a standard object-property model or something.

  • geometry: doesn't clash, though this seems to be yet another way to represent 2d geometric shapes on the web. We have SVG, <area>, canvas 2dcontext API, Geometry APIs. This seems most like <area>, except it's only geometry data without hyperlink.
  • coordinates: why is this an element, and not an attribute of geometry?

This is a pretty big discussion on its own, I think. The reason attributes aren't adequate for geometries is because we need to be able to use CSS selectors on whole or part geometries or even parts of geometry parts, in order to a) style them differently/appropriately than the rest of the geometry and b) make hyperlinks out of their constituent parts or parts of their constituent parts.

We really want to use CSS and not invent whole new layers of abstraction; I think we want to work with the SVG community to work on common requirements for CSS. Sometimes SVG is perfectly adequate for map annotations / graphics / legends, but generally is difficult to use for map features. SVG, while great, and while it may allow us to simulate / polyfill spatial feature geometries by allowing us to generate <path> (etc) elements out of the parts of the geometries in order to style or link them separately, is not generally used to represent map features because it's too slow on the one hand and not feature specific enough on the other hand. Linking and styling are related in that they (sometimes) require within-geometry markup and I believe the killer feature of the web is linking, so we want to re-use that feature between map layers and between map layers and html documents/ Web apps.

Attributes (like those used by svg paths) can have their own grammar, but they can't contain markup. We need to include markup in feature geometries for the reasons cited above.

@prushforth prushforth self-assigned this Jul 3, 2020
@zcorpan
Copy link
Author

zcorpan commented Jul 3, 2020

I don't have enough experience in this domain to understand the security concerns, but it seems that some level of change must be ongoing as the vocabulary changes. I hope that minor changes can be accomplished for maps as a high-level feature in a single (group of) changes.

See whatwg/html#2253 (comment)

However, new elements can be added to HTML without changing the parser, if the parsing behavior of unknown elements is OK (which is, parse like <span>; this is also how all custom elements are parsed). This should be OK for MapML I think. Only tile has an empty content model and could be parsed as a void element, but it doesn't seem critical and maybe we'd want to put something in tile elements in the future.

@zcorpan
Copy link
Author

zcorpan commented Jul 3, 2020

Yes, the intent has always been to achieve maximum compatibility with HTML. My understanding of this compatibility has evolved over the course of this project, to the degree that I now believe MapML may be a good marketing term (YMMV), but it should actually be part of HTML, so that it comes with a DOM API that allows it to be programmed by Web devs, when included inline in HTML. I appreciate that this may cause confusion to a reader such as yourself, and I'll work towards removing that confusion for developers who follow you.

OK cool. I suggest filing an issue at whatwg/html so they are aware of this proposed extension to HTML.

If so, that should be formalized in the MapML spec. Further, if the intent is to be able to embed MapML inline in HTML documents, I think the best way to do that is to make all MapML elements be HTML elements directly, and MapML documents be HTML documents. (XML serialization is still possible, like with HTML.)

Agreed.

@zcorpan
Copy link
Author

zcorpan commented Jul 3, 2020

Maybe use text/mapml+html as the MIME type, if MapML needs its own MIME type. Otherwise use text/html

OK. We haven't registered a MIME type yet. We will have to update the spec and the polyfill, as well as the servers (GeoServer, MapServer) that will support maps in HTML. I believe the use of text/mapml+html may involve a more elaborate registration. Unless I'm mistaken, which is my specialty, actually, +html suffix will need to be registered first, and may be starting a new suffix, akin to +json etc.

Looks like I was mistaken here. :-) I thought +foo was a convention, and +xml was the only one with special handling, but now I found

https://tools.ietf.org/html/rfc6839
https://www.iana.org/assignments/media-type-structured-suffix/media-type-structured-suffix.xhtml

I undecided right now if +html really makes sense. Maybe it doesn't and text/mapml is right.

I believe it does require it's own MIME type, so that browsers know what to do with it when the context isn't fetching a layer in a map. i.e. it might be possible to synthesize a surrounding html, head, body, map and layer as it does with an image file.

OK, yeah. This would need to be defined in HTML analogous to https://html.spec.whatwg.org/multipage/browsing-the-web.html#read-media

Even when the context is fetching a layer within a map, it might even be useful to render text/html even on the map, if the rendering mode was by coordinate-specific means vs normal html rendering. We should discuss this more, but I think it could be a valuable general situation / use case.

OK.

@prushforth
Copy link
Member

Only tile has an empty content model and could be parsed as a void element, but it doesn't seem critical and maybe we'd want to put something in tile elements in the future.

Funny you should mention that, as we've been developing static tile layer code lately. We imagine that it might be useful to have content in a tile, for example > 1 img or other set of elements, including svg and whatnot. The placement and zoom/pan animation would be done by the browser so it would be pretty simple to pile content into a tile.

@prushforth
Copy link
Member

OK cool. I suggest filing an issue at whatwg/html so they are aware of this proposed extension to HTML.

Is that jumping the gun? Anyway I guess I jumped it some time ago, but maybe it's time to bring some new energy to the process.

@zcorpan
Copy link
Author

zcorpan commented Jul 3, 2020

No it seems better to give the HTML folks a heads up about proposals that extend HTML early. If this was the plan all along, it's not early anymore, but better now than later. :)

@zcorpan
Copy link
Author

zcorpan commented Jul 3, 2020

Doctype should be ´<!doctype html>`

Filed #72

@zcorpan
Copy link
Author

zcorpan commented Jul 3, 2020

Interfaces for elements should be HTMLElement, or HTMLExtentElement : HTMLElement etc.

Does this need to be specified in the MapML specification/proposal? I think yes, but not sure.

Yes. (Filed #73)

@zcorpan
Copy link
Author

zcorpan commented Jul 3, 2020

  • head, title, base, meta: these don't seem to have MapML-specific processing. Remove from the MapML spec.

OK. What about specifying the meta values that we need? Where should those go?

What are those? I don't see meta names specified.

But you can specify those in MapML -- only the name and the processing associated with it. See https://html.spec.whatwg.org/multipage/semantics.html#standard-metadata-names for the currently standardized meta names in HTML.

@Malvoz
Copy link
Member

Malvoz commented Jul 4, 2020

What about specifying the meta values that we need? Where should those go?

What are those? I don't see meta names specified.

The zoom and tcrs values are mentioned in sections 4.1.4 Scale / Resolution / Zoom levels and 4.1.5 Extents respectively. Supposedly they'll need to be properly defined, I think that's the intent with issue #7.

@prushforth
Copy link
Member

prushforth commented Jul 4, 2020

@zcorpan A question I have about processing a text/mapml response received from.a 'layer src' request is: how will HTML elements that aren't in the MapML vocabulary of HTML be rendered? We have to have a proposal for that if it's all to be handled with no change to the parser.

@Malvoz
Copy link
Member

Malvoz commented Jul 14, 2020

+html suffix will need to be registered first, and may be starting a new suffix, akin to +json etc.

Looks like I was mistaken here. :-) I thought +foo was a convention

There was a similar consideration for HTML Modules to use a +html suffix, while they concluded not to use such a suffix, nobody questioned its validity in response to this and the following comment, which at least indicates that text/mapml+html would be valid.

@prushforth
Copy link
Member

@zcorpan wrote:

MapML can't be MicroXML and also be embeddable in HTML (without significantly changing the HTML parser).

MicroXML implies that MapML elements are in no namespace. Apart from RSS, languages that browsers support use namespaces.

Changing the HTML parser to support a new class of foreign content seems unlikely to happen for MapML, or even for anything. Even minor changes are usually met with resistance from implementers, due to security concerns.

With https://github.com/prushforth/htmlparser and https://www.w3.org/community/maps4html/2019/12/09/the-design-of-mapml/ , I've understood that the intent is to change MapML to be more "like HTML", instead of MicroXML.

If so, that should be formalized in the MapML spec. Further, if the intent is to be able to embed MapML inline in HTML documents, I think the best way to do that is to make all MapML elements be HTML elements directly, and MapML documents be HTML documents. (XML serialization is still possible, like with HTML.)

We've updated the MapML spec to say that MapML documents are in the xhtml namespace (xmlns="http://www.w3.org/1999/xhtml/"), and removed references to MicroXML. I've updated the demo service to serialize MapML documents into that namespace. We've also tested the polyfill to ensure that it supports the namespace version of MapML, and we've updated the GeoServer MapML Community Module to serialize MapML documents in the xhtml namespace.

es, the intent has always been to achieve maximum compatibility with HTML. My understanding of this compatibility has evolved over the course of this project, to the degree that I now believe MapML may be a good marketing term (YMMV), but it should actually be part of HTML, so that it comes with a DOM API that allows it to be programmed by Web devs, when included inline in HTML. I appreciate that this may cause confusion to a reader such as yourself, and I'll work towards removing that confusion for developers who follow you.

OK cool. I suggest filing an issue at whatwg/html so they are aware of this proposed extension to HTML.

Robert and I agreed we should have a community group discussion asap to help us decide what to put into this issue for the best possible response. Please vote for the meeting time.

@prushforth
Copy link
Member

prushforth commented Jan 27, 2021

Here are the meeting details. Add your comments below for discussion there, if applicable.

@prushforth
Copy link
Member

We've moved the xml vocabulary into the xhtml namespace. We opened the issue with WHATWG. Cleaning up and closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants