Apps are cobbled together from sub-systems and libraries. Some of those
may use clojure.data.xml, either to share their products with their client
or for their internal purposes. As soon as two libraries on Clojars differ
in their namespace-URI to keyword-namespace mapping, has the ship sunk?
Nonetheless, value equality might sometimes be useful. How to achieve it?
There is already a globally distinct, agreed, and unambiguous way to refer
to each well-known XML namespace URI. It is the URI itself. If the
keyword-namespace must have the same properties, it ought to follow from
the URI, not be left to the discretion of individual consumers.
Could there be a well-known translation from namespace-URI to
keyword-namespace and back? These keyword namespaces would be cumbersome
(as they must include the whole URI and also avoid colliding with the
namespace of any other namespaced keywords anywhere), but consumers could
alias them conveniently without impacting value comparisons:
(->> 'xmlns.http.www.w3.org.n1999.xhtml
create-ns
ns-name
symbol
(alias 'xhtml))
To account for the whole space of URIs, without violating the Clojure or
EDN keyword namespace spec or compromising reverse translation back to the
URI, you might have to go further. For example, combine a legible symbol
name computed with some loss (as an assertion) and a Base-64 encoding...
(->>
'xmlns.http.maven.apache.org.POM.4.0.0.aHR0cDovL21hdmVuLmFwYWNoZS5vcmcvUE9NLzQuMC4wCg==
create-ns
ns-name
symbol
(alias 'pom))
A well-known formula for namespace keywords representing XML namespaces
could replace the ad-hoc mutable map and satisfy your dual aims that
clojure.data.xml applications might use keywords for convenience while also
maintaining strict value equality of the XML data structures all the way to
the horizon. (The data structure would use such keywords for all element
tags.)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.