Hi -
I'm exploring cxml, and I'm running into trouble using the cxml- xmls:map-node. I don't know whether I'm doing something stupid or whether it's a bug, so I thought I'd ask here.
I began by following the example in the Quick-Start Guide (http:// common-lisp.net/project/cxml/quickstart.html#id54132) and found myself in the debugger with an error related to namespaces:
CL-USER> (with-open-file (out "example.out" :direction :output :element-type '(unsigned-byte 8)) (cxml-xmls:map-node (cxml:make-character-stream- sink out) '("test" (("a" "b")) ("child" nil))))
serializing with :INCLUDE-NAMESPACE-URI, but node was created without namespace URI [Condition of type SIMPLE-ERROR]
Restarts: 0: [ABORT] Return to SLIME's top level. 1: [ABORT-BREAK] Reset this process 2: [ABORT] Kill this process
Backtrace: 0: ((:INTERNAL CXML-XMLS::WALK CXML-XMLS::MAP-NODE/LNAMES) '("test" (("a" "b")) ("child" NIL))) 1: (CXML-XMLS::MAP-NODE/LNAMES #<CXML::NAMESPACE-NORMALIZER #x8D0290E> '("test" (("a" "b")) ("child" NIL)) 'T) 2: (#<Anonymous Function #x8D04486>)
I have to admit that I didn't find this error to be very useful in terms of understanding what the problem is.
My second attempt was to avoid constructing the xmls-style data by hand but to instead take the output of a cxml parse. Suffice it to say that I ran into the same issue:
CL-USER> (with-open-file (out "foo.out" :direction :output :element- type '(unsigned-byte 8)) (cxml-xmls:map-node (cxml:make-character-stream- sink out) (cxml:parse-file "foo.xml" (cxml-xmls:make-xmls-builder))))
serializing with :INCLUDE-NAMESPACE-URI, but node was created without namespace URI [Condition of type SIMPLE-ERROR]
Restarts: 0: [ABORT] Return to SLIME's top level. 1: [ABORT-BREAK] Reset this process 2: [ABORT] Kill this process
Backtrace: 0: ((:INTERNAL CXML-XMLS::WALK CXML-XMLS::MAP-NODE/LNAMES) '("foo" NIL " " ("bar" (("quux" "quux")) " baz ") " ")) 1: (CXML-XMLS::MAP-NODE/LNAMES #<CXML::NAMESPACE-NORMALIZER #x8CFCF86> '("foo" NIL " " ("bar" (("quux" "quux")) " baz ") " ") 'T) 2: (#<Anonymous Function #x8C7D31E>) 3: (SWANK::EVAL-REGION "(with-open-file (out "foo.out" :direction :output :element-type '(unsigned-byte 8)) (cxml-xmls:map-node (cxml:make-character-stream-sink out) (cxml:parse-file "foo.xml" (cxml-xmls:make-xmls- builder)))) ")
So now I'm sort of at a loss for what to do next. And my basic question once again is: am I doing something stupid? Or is the xmls- style serialization facility broken?
Thanks.
Dan
Okay -- I was being stupid. I did a bit more reading and found the :include-namespace-uri keyword for cxml-xmls:map-node, set it to nil, and found that it all works.
My only suggestion, therefore, is to update the example in the Quick- Start guide to reflect this usage.
Sorry for the red herring.
Dan
On Aug 8, 2008, at 8:32 AM, Daniel Katz wrote:
Hi -
I'm exploring cxml, and I'm running into trouble using the cxml- xmls:map-node. I don't know whether I'm doing something stupid or whether it's a bug, so I thought I'd ask here.
I began by following the example in the Quick-Start Guide (http:// common-lisp.net/project/cxml/quickstart.html#id54132) and found myself in the debugger with an error related to namespaces:
CL-USER> (with-open-file (out "example.out" :direction :output :element-type '(unsigned-byte 8)) (cxml-xmls:map-node (cxml:make-character-stream- sink out) '("test" (("a" "b")) ("child" nil))))
serializing with :INCLUDE-NAMESPACE-URI, but node was created without namespace URI [Condition of type SIMPLE-ERROR]
Restarts: 0: [ABORT] Return to SLIME's top level. 1: [ABORT-BREAK] Reset this process 2: [ABORT] Kill this process
Backtrace: 0: ((:INTERNAL CXML-XMLS::WALK CXML-XMLS::MAP-NODE/LNAMES) '("test" (("a" "b")) ("child" NIL))) 1: (CXML-XMLS::MAP-NODE/LNAMES #<CXML::NAMESPACE-NORMALIZER #x8D0290E> '("test" (("a" "b")) ("child" NIL)) 'T) 2: (#<Anonymous Function #x8D04486>)
I have to admit that I didn't find this error to be very useful in terms of understanding what the problem is.
My second attempt was to avoid constructing the xmls-style data by hand but to instead take the output of a cxml parse. Suffice it to say that I ran into the same issue:
CL-USER> (with-open-file (out "foo.out" :direction :output :element-type '(unsigned-byte 8)) (cxml-xmls:map-node (cxml:make-character-stream- sink out) (cxml:parse-file "foo.xml" (cxml-xmls:make-xmls-builder))))
serializing with :INCLUDE-NAMESPACE-URI, but node was created without namespace URI [Condition of type SIMPLE-ERROR]
Restarts: 0: [ABORT] Return to SLIME's top level. 1: [ABORT-BREAK] Reset this process 2: [ABORT] Kill this process
Backtrace: 0: ((:INTERNAL CXML-XMLS::WALK CXML-XMLS::MAP-NODE/LNAMES) '("foo" NIL " " ("bar" (("quux" "quux")) " baz ") " ")) 1: (CXML-XMLS::MAP-NODE/LNAMES #<CXML::NAMESPACE-NORMALIZER #x8CFCF86> '("foo" NIL " " ("bar" (("quux" "quux")) " baz ") " ") 'T) 2: (#<Anonymous Function #x8C7D31E>) 3: (SWANK::EVAL-REGION "(with-open-file (out "foo.out" :direction :output :element-type '(unsigned-byte 8)) (cxml-xmls:map-node (cxml:make-character-stream-sink out) (cxml:parse-file "foo.xml" (cxml-xmls:make-xmls- builder)))) ")
So now I'm sort of at a loss for what to do next. And my basic question once again is: am I doing something stupid? Or is the xmls-style serialization facility broken?
Thanks.
Dan