Quoting Chaitanya Gupta (mail@chaitanyagupta.com):
CL-USER> (flexi-streams:with-input-from-sequence (s *x) (cxml:parse s (cxml-dom:make-dom-builder)))
[...]
Only file streams are supported?
Thanks for the report. That was a bug in PARSE, which should be fixed in cxml CVS now.
(You could also use the older function CXML:PARSE-STREAM instead of the new interface CXML:PARSE. The former doesn't have the bug.)
No. The reason I am asking is because I get a (huge) XML over a socket; I think parsing directly from the socket stream should be much more efficient than first reading the XML into a string, and then parsing the string (is this assumption correct?).
Sure, parsing from a socket directly is the natural solution, and needs only constant space rather than O(n) space with the length of the input. (Not taking into account that the DOM tree obviously needs O(n) space.)
For now, you'd have to open the socket using :element-type '(unsigned-byte 8), or take advantage of bivalent streams on Lisps that provide them.
In the long term, I'll try to add support for character streams.
(But note that cxml will detect the encoding declared in the XML declaration when parsing from binary streams. It won't be able to do that when the Lisp is already handling the external-format conversion in the stream. That's the primary reason binary streams are better for XML parsing.)
d.