[cxml-devel] Bugs in handling namespaces
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi all, Given how many issues I'm posting, I should probably start contributing fixes too :-) Is there a starter document that describes the components of cxml at a high level? So, here's what I'm seeing when I try to introduce multiple namespaces into an XML document... Note that the final output states the namespaces for both svg and xlink as implicit. Further, implicit namespace declarations are not necessarily applied to attributes. CL-USER(36): (setq svg (dom:create-document 'rune-dom:implementation "http://www.w3.org/2000/svg" "svg" (dom:create-document-type 'rune-dom:implementation "svg" "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"))) #<RUNE-DOM::DOCUMENT @ #x21142992> CL-USER(37): (dom:set-attribute-ns (dom:document-element svg) "http://www.w3.org/1999/xlink" "href" "#nothing") CL-USER(38): (dom:map-document (cxml:make-namespace-normalizer (cxml:make-octet-stream-sink *standard-output*)) svg :include-doctype :canonical-notations) <svg href="#nothing" xmlns="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"></svg> Now we see what happens when we start with a document in a string. See the attached file. Here's what happens when I parse and re-output the file: CL-USER(54): (setq svg (cxml:parse-file #p"C:\\test.xml" (rune-dom:make-dom-builder))) #<RUNE-DOM::DOCUMENT @ #x20c05482> CL-USER(55): (dom:map-document (cxml:make-namespace-normalizer (cxml:make-octet-stream-sink *standard-output*)) svg :include-doctype :canonical-notations) <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/2000/svg"> ; <defs> <rect fill="black" height="10" id="default-node-shape" stroke="blue" width="60"></rect> </defs> </svg> Thanks in advance, Sunil -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.1 (Cygwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFE5UqBjRnqWMAEf1cRAtzZAKCN6V3B1d/UTBfFirAZ9RcDhXy7ywCdEkzm 78n1JvO/0dLKsvkHNQuxNpA= =WCs7 -----END PGP SIGNATURE-----
Quoting Sunil Mishra (smishra@sfmishras.com):
So, here's what I'm seeing when I try to introduce multiple namespaces into an XML document... Note that the final output states the namespaces for both svg and xlink as implicit. Further, implicit namespace declarations are not necessarily applied to attributes.
Thanks for the reports. The namespace normalizer (xml/xmlns-normalizer.lisp) is very new and very untested. In addition, there was a buglet in map-document. (It would be quite helpful if you could come up with more test cases for the namespace normalizer as a basis for a little test suite!)
CL-USER(38): (dom:map-document (cxml:make-namespace-normalizer (cxml:make-octet-stream-sink *standard-output*)) svg :include-doctype :canonical-notations) <svg href="#nothing" xmlns="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"></svg>
Okay, now that gives: <svg NS1:href="#nothing" xmlns="http://www.w3.org/2000/svg" xmlns:NS1="http://www.w3.org/1999/xlink"></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/2000/svg"> ; <defs> <rect fill="black" height="10" id="default-node-shape" stroke="blue" width="60"></rect> </defs> </svg>
Fixed that too. Please update to CVS and test again. Thanks, d.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi David, Thanks for the fixes, they do address some of the issues I was seeing, but there's still a problem in my program. I will send you another test by Wednesday. Sunil David Lichteblau wrote:
Quoting Sunil Mishra (smishra@sfmishras.com):
So, here's what I'm seeing when I try to introduce multiple namespaces into an XML document... Note that the final output states the namespaces for both svg and xlink as implicit. Further, implicit namespace declarations are not necessarily applied to attributes.
Thanks for the reports.
The namespace normalizer (xml/xmlns-normalizer.lisp) is very new and very untested. In addition, there was a buglet in map-document.
(It would be quite helpful if you could come up with more test cases for the namespace normalizer as a basis for a little test suite!)
CL-USER(38): (dom:map-document (cxml:make-namespace-normalizer (cxml:make-octet-stream-sink *standard-output*)) svg :include-doctype :canonical-notations) <svg href="#nothing" xmlns="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"></svg>
Okay, now that gives: <svg NS1:href="#nothing" xmlns="http://www.w3.org/2000/svg" xmlns:NS1="http://www.w3.org/1999/xlink"></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/2000/svg"> ; <defs> <rect fill="black" height="10" id="default-node-shape" stroke="blue" width="60"></rect> </defs> </svg>
Fixed that too.
Please update to CVS and test again.
Thanks, d. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.1 (Cygwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFE6dDIjRnqWMAEf1cRAo/5AJ45y+UQzLKRLJ6o67sIgeO1asUKwACeOtsJ n3CNp3fLeyNOjTRV9JLs4+M= =EhSl -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi David, I've attached a document that I then manipulate, to demonstrate the problem I'm still having... I insert a new child <use/> in the document, then add an "xlink:href" attribute. This somehow mangles the xlink namespace declaration in the <svg/> element. BTW, note that the graph.xml here is the same as the one I had sent with the clone-node problem. I have made sure when parsing that the DTD is available and included when the document is parsed. I don't know if that will make a difference in your testing. Sunil CL-USER(22): (dom:insert-before (dom:document-element /d) (dom:create-element-ns /d "http://www.w3.org/2000/svg" "use") nil) #<RUNE-DOM::ELEMENT use @ #x20bdbaca> CL-USER(23): (dom:set-attribute-ns * "http://www.w3.org/1999/xlink" "href" "#nothing") CL-USER(24): (dom:map-document (cxml:make-namespace-normalizer (cxml:make-octet-stream-sink *standard-output*)) /d :include-doctype :canonical-notations) <svg xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"> ; <defs> <rect fill="black" height="10" id="default-node-shape" stroke="blue" width="60"></rect> </defs> <use xlink:href="#nothing"></use></svg> #<MULTIVALENT stream socket connected from localhost/3982 to localhost/3983 @ #x205003d2> Sunil Mishra wrote:
Hi David,
Thanks for the fixes, they do address some of the issues I was seeing, but there's still a problem in my program. I will send you another test by Wednesday.
Sunil
David Lichteblau wrote:
Quoting Sunil Mishra (smishra@sfmishras.com):
So, here's what I'm seeing when I try to introduce multiple namespaces into an XML document... Note that the final output states the namespaces for both svg and xlink as implicit. Further, implicit namespace declarations are not necessarily applied to attributes. Thanks for the reports.
The namespace normalizer (xml/xmlns-normalizer.lisp) is very new and very untested. In addition, there was a buglet in map-document.
(It would be quite helpful if you could come up with more test cases for the namespace normalizer as a basis for a little test suite!)
CL-USER(38): (dom:map-document (cxml:make-namespace-normalizer (cxml:make-octet-stream-sink *standard-output*)) svg :include-doctype :canonical-notations) <svg href="#nothing" xmlns="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg"></svg> Okay, now that gives: <svg NS1:href="#nothing" xmlns="http://www.w3.org/2000/svg" xmlns:NS1="http://www.w3.org/1999/xlink"></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/2000/svg"> ; <defs> <rect fill="black" height="10" id="default-node-shape" stroke="blue" width="60"></rect> </defs> </svg> Fixed that too.
Please update to CVS and test again.
Thanks, d. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.1 (Cygwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFE6zoUjRnqWMAEf1cRAiseAKC05xs/jlVCFvU3vTWotcOr+W46PwCgzG5Y FwGOslNR8RcurmPA+wyKdUg= =UNPt -----END PGP SIGNATURE-----
I've attached a document that I then manipulate, to demonstrate the problem I'm still having... I insert a new child <use/> in the document, then add an "xlink:href" attribute. This somehow mangles the xlink namespace declaration in the <svg/> element. [...] <svg xlink="http://www.w3.org/1999/xlink" ^^^^^^
Hi, Quoting Sunil Mishra (smishra@sfmishras.com): that one? I am afraid I cannot reproduce this problem with cxml CVS. Can you make sure you have all changes from CVS? (If the problem really still persists, what Lisp are you on? From your pastes, I am guessing Allegro CL with the ANSI image and Unicode support, is that right?) Anyway, I will try to build a test suite for the xmlns normalizer based on modified documents from the XML test suite. If there are any bugs left in this area, that should flush them out. Stay tuned. :-) d.
participants (2)
-
David Lichteblau
-
Sunil Mishra