David Lichteblau wrote:
Quoting Douglas Crosher (dtc@scieneer.com):
o Add support for including the namespace URI in the element and attribute names.
Thank you committing these changes and for enhancing it further.
...
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.
Yes this was intended to just remove the default namespace attribute, with an attribute local-name of 'nil. Dropping this test does look like the right thing to do as the attribute will be needed when serializing, and *include-xmlns-attributes* can be set to false to avoid them. Cleanup patch attached.
Regards Douglas Crosher
Index: xml/xmls-compat.lisp =================================================================== RCS file: /project/cxml/cvsroot/cxml/xml/xmls-compat.lisp,v retrieving revision 1.4 diff -u -r1.4 xmls-compat.lisp --- xml/xmls-compat.lisp 16 Jun 2007 11:07:58 -0000 1.4 +++ xml/xmls-compat.lisp 17 Jun 2007 04:23:40 -0000 @@ -88,6 +88,7 @@
(defmethod sax:start-element ((handler xmls-builder) namespace-uri local-name qname attributes) + (declare (ignore qname)) (let* ((include-default-values (include-default-values handler)) (include-namespace-uri (include-namespace-uri handler)) (attributes @@ -95,24 +96,18 @@ for attr in attributes for attr-namespace-uri = (sax:attribute-namespace-uri attr) for attr-local-name = (sax:attribute-local-name attr) - when (and (or (sax:attribute-specified-p attr) - include-default-values) - #+(or) - (or (not include-namespace-uri) - (not attr-namespace-uri) - attr-local-name)) + when (or (sax:attribute-specified-p attr) + include-default-values) collect (list (cond (include-namespace-uri - (cond (attr-namespace-uri - (cons attr-local-name attr-namespace-uri)) - (t - (sax:attribute-qname attr)))) + (if attr-namespace-uri + (cons attr-local-name attr-namespace-uri) + (sax:attribute-qname attr))) (t (sax:attribute-qname attr))) (sax:attribute-value attr)))) - (namespace (when include-namespace-uri namespace-uri)) (node (make-node :name local-name - :ns namespace + :ns (and include-namespace-uri namespace-uri) :attrs attributes)) (parent (car (element-stack handler)))) (if parent