Greetings All,
Does anyone have an example of using the cxml:doctype function? The code indicates that the last argument is of type puri:uri, which I think I have in the following:
(cxml:doctype "suite" "suite" (puri:uri "http://testng.org/testng-1.0.dtd"))
however any use of this generates an error in CCL:
value #http://testng.org/testng-1.0.dtd%3E is not of the expected type SEQUENCE.
I'm using slime, but not sure if this is related. The same error occurs at the command line. Unfortunately, the documentation for puri seems to have moved, so beyond looking at the code (that I'm unfamiliar with), the best I can do is guess.
I know this function is relatively new, so am wondering if it's been widely tested. Are there any alternatives to writing a XML doctype? I need to write quite a few, sometimes large, XML test suites for testng.
Cheers, - SteveN
Quoting Nunez Steve (steve_nunez@yahoo.com):
Does anyone have an example of using the cxml:doctype function? The code indicates that the last argument is of type puri:uri, which I think I have in the following:
From the last time this came up, I think that the documentation is
simply wrong and should say "string" there rather than "puri:uri" here.
Sorry for not having fixed the documentation yet. If you have a documentation patch (ideally plus a test case), that would be great.
d.
Thanks. Sadly, I saved the change before I could make a diff. The file is xml/unparse.lisp.
A follow-up question: Is there a way to emit a newline into the file? It would help in readability of some parts.
Cheers, - Steve
________________________________ From: David Lichteblau david@lichteblau.com To: Nunez Steve steve_nunez@yahoo.com Cc: cxml-devel@common-lisp.net Sent: Sunday, June 14, 2009 2:01:26 AM Subject: Re: [cxml-devel] cxml:doctype function
Quoting Nunez Steve (steve_nunez@yahoo.com):
Does anyone have an example of using the cxml:doctype function? The code indicates that the last argument is of type puri:uri, which I think I have in the following:
From the last time this came up, I think that the documentation is simply wrong and should say "string" there rather than "puri:uri" here.
Sorry for not having fixed the documentation yet. If you have a documentation patch (ideally plus a test case), that would be great.
d.
Quoting Nunez Steve (steve_nunez@yahoo.com):
A follow-up question: Is there a way to emit a newline into the file? It would help in readability of some parts.
Unless the sink is in canonical mode (and canonical isn't the default anymore in current cxml), newline characters in text are written literally, so just write text including a newline. Example:
CL-USER> (cxml:with-xml-output (cxml:make-string-sink) (cxml:with-element "test" (cxml:text (format nil "foo~%bar")))) "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <test>foo bar</test>"
That's for manual breaks. If you were hoping for automatic indentation, there's the :INDENTATION keyword argument:
CL-USER> (cxml:with-xml-output (cxml:make-string-sink :indentation 2) (cxml:with-element "outer" (cxml:with-element "inner" (cxml:text (format nil "foo~%bar"))))) "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <outer> <inner> foo bar</inner> </outer>"
The indentation support isn't very good though. I use it only for debugging purposes. Also note that it reindents texts, removing the explicit newline.
d.
Thanks. What I am hoping for is a way to write multi-line comments. cxml:text doesn't seem to work outside elements.
________________________________ From: David Lichteblau david@lichteblau.com To: Nunez Steve steve_nunez@yahoo.com Cc: cxml-devel@common-lisp.net Sent: Friday, June 19, 2009 7:33:53 PM Subject: Re: [cxml-devel] cxml:doctype function
Quoting Nunez Steve (steve_nunez@yahoo.com):
A follow-up question: Is there a way to emit a newline into the file? It would help in readability of some parts.
Unless the sink is in canonical mode (and canonical isn't the default anymore in current cxml), newline characters in text are written literally, so just write text including a newline. Example:
CL-USER> (cxml:with-xml-output (cxml:make-string-sink) (cxml:with-element "test" (cxml:text (format nil "foo~%bar")))) "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <test>foo bar</test>"
That's for manual breaks. If you were hoping for automatic indentation, there's the :INDENTATION keyword argument:
CL-USER> (cxml:with-xml-output (cxml:make-string-sink :indentation 2) (cxml:with-element "outer" (cxml:with-element "inner" (cxml:text (format nil "foo~%bar"))))) "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <outer> <inner> foo bar</inner> </outer>"
The indentation support isn't very good though. I use it only for debugging purposes. Also note that it reindents texts, removing the explicit newline.
d.
Quoting Nunez Steve (steve_nunez@yahoo.com):
Thanks. What I am hoping for is a way to write multi-line comments. cxml:text doesn't seem to work outside elements.
Same approach.
CL-USER> (cxml:with-xml-output (cxml:make-character-stream-sink *standard-output*) (cxml:comment (format nil "~%foo~%bar~%")) (cxml:with-element "test")) <?xml version="1.0" encoding="UTF-8"?> <!-- foo bar --><test/>