[cxml-devel] Counter-intuitive API for cxml:parse on LWM?
David Lichteblau
david at lichteblau.com
Thu Apr 21 19:06:49 UTC 2011
Hi,
Quoting Marco Antoniotti (marcoxa at cs.nyu.edu):
> here is the example on LWM:
what is LWM?
> CL-USER 17 > (cxml:parse #P"CellCycle-1991Tys-2.xml" (cxml:make-whitespace-normalizer (make-instance 'sax:default-handler)) :validate nil)
> NIL
>
> CL-USER 18 > (with-open-file (f #P"CellCycle-1991Tys-2.xml" :direction :input)
> (cxml:parse f (cxml:make-whitespace-normalizer (make-instance 'sax:default-handler)) :validate nil))
>
> Error: Binary operation READ-BYTE attempted on character stream #<STREAM::LATIN-1-FILE-STREAM /Users/marcoxa/Projects/Genomics/biolosyst/sbmlambda/tests/CellCycle-1991Tys-2.xml>.
> 1 (abort) Return to level 0.
> 2 Return to top loop level 0.
[...]
> Parse an XML document from @var{input}, which can be a string, pathname,
> octet vector, or stream.
[...]
> It appears that you need a 'xstream', but this is against the doc string content (and IMHO, against common sense).
Not an xstream, no (those are internal to cxml and would only be used
very rarely by user code).
What you need is a _binary_ stream though (and the docstring could
indeed be improved to say "octet vector, or octet stream" rather than
just "octet vector, or stream".
In other words, add :element-type '(unsigned-byte 8) to the
with-open-file.
d.
More information about the cxml-devel
mailing list