tyxml
tyxml copied to clipboard
Handling of XML namespaces
Right now, Svg
and Html
functors takes the same XML
parameter, but their respective elements should not be instantiated in the same namespace (svg elements "live" in http://www.w3.org/2000/svg).
The current workaround is to pass a different XML instance, manually specialized for a namespace.
But this is also done explicitly by Tyxml only for the root svg element: https://github.com/ocsigen/tyxml/blob/master/lib/svg_f.ml#L740-L742. It would be nice if the behavior was consistent: pass the namespace for all elements or for none. Actually, none is probably a better solution since, as far as the DOM is concerned, xmlns is not handled like a normal attribute (it changes the meaning of the rest of the syntax).
It seems ok if each instance of Xml has to handle that internally. This caveat should just be properly documented.