Marco Antoniotti | 21 Apr 2011 20:45
Picon

Counter-intuitive API for cxml:parse on LWM?

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

 " <at> arg[input]{A string, pathname, octet vector, or stream.}
   <at> arg[handler]{A <at> class{SAX handler}}
   <at> arg[validate]{Boolean.  Defaults to <at> code{nil}.  If true, parse in
     validating mode, i.e. assert that the document contains a DOCTYPE
     declaration and conforms to the DTD declared.}
...
   <at> arg[recode]{Boolean.  (Ignored on Lisps with Unicode
     support.)  Recode rods to UTF-8 strings.  Defaults to true.
     Make sure to use <at> fun{utf8-dom:make-dom-builder} if this
     option is enabled and <at> fun{rune-dom:make-dom-builder}
     otherwise.}
   <at> return{The value returned by <at> fun{sax:end-document} on <at> var{handler}.}

   Parse an XML document from <at> var{input}, which can be a string, pathname,
   octet vector, or stream.
...
   All SAX parsing functions share the same keyword arguments.  Refer to
   <at> 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



Gmane