[cxml-devel] Counter-intuitive API for cxml:parse on LWM?
Marco Antoniotti
marcoxa at cs.nyu.edu
Thu Apr 21 18:45:24 UTC 2011
Hi
here is the example on 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.
Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.
CL-USER 19 : 1 >
And here is the doc string for cxml:parse
"@arg[input]{A string, pathname, octet vector, or stream.}
@arg[handler]{A @class{SAX handler}}
@arg[validate]{Boolean. Defaults to @code{nil}. If true, parse in
validating mode, i.e. assert that the document contains a DOCTYPE
declaration and conforms to the DTD declared.}
...
@arg[recode]{Boolean. (Ignored on Lisps with Unicode
support.) Recode rods to UTF-8 strings. Defaults to true.
Make sure to use @fun{utf8-dom:make-dom-builder} if this
option is enabled and @fun{rune-dom:make-dom-builder}
otherwise.}
@return{The value returned by @fun{sax:end-document} on @var{handler}.}
Parse an XML document from @var{input}, which can be a string, pathname,
octet vector, or stream.
...
All SAX parsing functions share the same keyword arguments. Refer to
@fun{parse} for details on keyword arguments."
It appears that you need a 'xstream', but this is against the doc string content (and IMHO, against common sense).
Cheers
--
Marco Antoniotti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cxml-devel/attachments/20110421/f58948bd/attachment.html>
More information about the cxml-devel
mailing list