Hi,
I am tring to parse an XML from a stream using CXML:PARSE. I get an error when I try that.
Here's the input form and the backtrace.
---
CL-USER> (with-input-from-string (s "<foo>bar</foo>") (cxml:parse s (cxml-dom:make-dom-builder))) ; Evaluation aborted
can't read-byte from a string stream: #<STRING-INPUT-SIMPLE-STREAM "<foo>bar</foo>" pos 0 @ #x1108e69a> [Condition of type TYPE-ERROR]
Restarts: 0: [ABORT-REQUEST] Abort handling SLIME request. 1: [ABORT] Abort entirely from this (lisp) process.
Backtrace: 0: (SWANK::DEBUG-IN-EMACS #<TYPE-ERROR @ #x110fb1f2>) 1: (SWANK:SWANK-DEBUGGER-HOOK #<TYPE-ERROR @ #x110fb1f2> #<Function SWANK-DEBUGGER-HOOK>) 2: (ERROR TYPE-ERROR :DATUM #1=#<STRING-INPUT-SIMPLE-STREAM "<foo>bar</foo>" pos 0 @ #x1108e69a> :EXPECTED-TYPE STREAM :FORMAT-CONTROL "can't read-byte from a string stream: ~s" :FORMAT-ARGUMENTS (#1#)) 3: ((METHOD RUNES::FIGURE-ENCODING (STREAM)) #<STRING-INPUT-SIMPLE-STREAM "<foo>bar</foo>" pos 0 @ #x1108e69a>) 4: (RUNES:MAKE-XSTREAM #<STRING-INPUT-SIMPLE-STREAM "<foo>bar</foo>" pos 0 @ #x1108e69a> :SPEED 8192) 5: (CXML:PARSE #<STRING-INPUT-SIMPLE-STREAM "<foo>bar</foo>" pos 0 @ #x1108e69a> #<RUNE-DOM::DOM-BUILDER @ #x110fb1b2>)
---
I tried this on ACL 8.0 and CXML is from CVS. Shouldn't string streams be parseable?
Chaitanya
Hi,
Quoting Chaitanya Gupta (mail@chaitanyagupta.com):
CL-USER> (with-input-from-string (s "<foo>bar</foo>") (cxml:parse s (cxml-dom:make-dom-builder))) I tried this on ACL 8.0 and CXML is from CVS. Shouldn't string streams be parseable?
parsing from character streams is a reasonable feature suggestion, but currently not implemented. When parsing from streams, the stream must have element-type (unsigned-byte 8).
However, you can parse from a string directly. Is that good enough for now?
(cxml:parse "<foo>bar</foo>" (cxml-dom:make-dom-builder))
d.