Cannot customise prefixes when aggregating namespaces
Description
The goal is to emit XML with namespaces aggregated at the document root, and with prefixes customised. data.xml provides aggregate-xmlns for this. Unfortunately it seems to interfere with xmlns prefix :attrs.
To reproduce first set up some test data:
Namespace aggregation with (xml/aggregate-xmlns document) works fine, but now I would like to customise the prefixes. Here the :attrs seem to have no effect:
Doing aggregate-xmlns last instead throws an exception:
I could verify that the right prefixes are generated when I leave aggregate-xmlns out of the picture - but aggregation is the goal.
Environment
Java 10 Clojure 1.9 data.xml 0.2.0-alpha5
Activity
David Bürgin
May 10, 2018 at 2:24 PM
And by the way, not sure why aggregate-xmlns always generates new prefixes for the aggregated namespaces? Wouldn’t it be better to preserve encountered prefixes as much as possible?
That is, if somewhere in the tree there is an element <foo:x xmlns:foo="http://foo" /> I would expect this namespace to be aggregated in the root with prefix foo … that way emit will automatically generate the expected prefixes.
Herwig Hochleitner
April 6, 2018 at 1:11 PM
OK, thanks for the report! I'll take a look later ..
The goal is to emit XML with namespaces aggregated at the document root, and with prefixes customised. data.xml provides
aggregate-xmlns
for this. Unfortunately it seems to interfere with xmlns prefix:attrs
.To reproduce first set up some test data:
Namespace aggregation with
(xml/aggregate-xmlns document)
works fine, but now I would like to customise the prefixes. Here the:attrs
seem to have no effect:Doing
aggregate-xmlns
last instead throws an exception:I could verify that the right prefixes are generated when I leave
aggregate-xmlns
out of the picture - but aggregation is the goal.