[cxml-devel] Patch: Add XMLS support for including the namespace URI in the element and attribute names.
David Lichteblau
david at lichteblau.com
Sat Jun 16 11:38:02 UTC 2007
Quoting Douglas Crosher (dtc at scieneer.com):
> o Add support for including the namespace URI in the element and
> attribute names.
Thanks, that was a long-standing issue.
Checked in with a few changes:
> +(defun make-xmls-builder (&key (include-default-values t)
> + (include-namespace-uri nil))
Applied with default (include-namespace-uri t).
> + when (and (or (sax:attribute-specified-p attr)
> + include-default-values)
> + (or (not include-namespace-uri)
> + (not attr-namespace-uri)
> + attr-local-name))
What is the (or ..) test for? IIUC, it currently removes declarations
for the default namespace (xmlns="a") but not declarations for other
namespaces (xmlns:b="a"). If removal of namespace declarations was the
idea of this test, it should probably affect all of them, but only if
*include-xmlns-attributes* is false.
Applied without the OR.
> + (t
> + (let ((lq (length qname))
> + (ll (length local-name)))
> + (if (eql lq ll)
> + nil
> + (subseq qname 0 (- lq ll 1)))))))
Changed to use just qnames in this mode. The old mode with pairs of
local name and prefix was useless.
Finally, I have changed serialization (CXML-XMLS:MAP-NODE) to also
distinguish between the two representations. With namespace URI, we run
the events through the namespace normalizer, which invents prefixes for
us. Without namespaces, we continue to generate namespace-less SAX
events, which are suitable for normal serialization purposes (but
nothing else, really).
More information about the cxml-devel
mailing list