[cxml-devel] Catalog problems

David Lichteblau david at lichteblau.com
Mon Jan 9 02:07:57 UTC 2006


Quoting Adam C. Emerson (aemerson at acm.org):
> An attempt to access an array of element-type NIL was made.  Congratulations!
>    [Condition of type SB-KERNEL:NIL-ARRAY-ACCESSED-ERROR]

Heh.

Well, the puri library was apparently written by someone trying to
maximize speed at all cost.  It doesn't work with non-simple strings.

Here's a second attempt at the patch, including a workaround for that.

I'm also attaching an unrelated patch to puri, which you might need if
you're running a very current SBCL.  (puri uses sb-kernel:shrink-vector,
which is not exactly a supported interface in SBCL and has recently
changed behaviour.)
-------------- next part --------------
Index: xml-parse.lisp
===================================================================
RCS file: /project/cxml/cvsroot/cxml/xml/xml-parse.lisp,v
retrieving revision 1.58
diff -u -u -u -r1.58 xml-parse.lisp
--- xml-parse.lisp	29 Dec 2005 00:31:36 -0000	1.58
+++ xml-parse.lisp	9 Jan 2006 01:55:21 -0000
@@ -2011,8 +2011,8 @@
   ;; :FILE and NIL anway.
   (when (eql (search "file://" str) 0)
     (setf str (subseq str (length "file://"))))
-  (puri:parse-uri str))
+  (puri:parse-uri (coerce str 'simple-string)))
 
 (defun p/system-literal (input)
   (let* ((rod (p/id input))
--- catalog.lisp.~1.2.~	2005-11-28 23:25:45.000000000 +0100
+++ catalog.lisp	2006-01-09 02:57:05.000000000 +0100
@@ -222,8 +222,8 @@
 (defun parse-catalog-file (uri)
   (handler-case
       (parse-catalog-file/strict uri)
-    (file-error () nil)
-    (parser-error () nil)))
+    ((or file-error xml-parse-error) (c)
+      (warn "ignoring catalog error: ~A" c))))
 
 (defparameter *catalog-dtd*
     (let* ((cxml
@@ -248,9 +248,8 @@
                                  :element-type '(unsigned-byte 8)
                                  :direction :input))
         (parse-stream s
-                      (make-recoder (make-instance 'catalog-parser :uri uri)
-                                    #'rod-to-utf8-string)
-                      :validate t
+                      (make-instance 'catalog-parser :uri uri)
+                      :validate nil
                       :dtd (make-extid nil dtd-sysid)
                       :root #"catalog"
                       :entity-resolver #'entity-resolver)))))
@@ -284,7 +283,11 @@
   (setf lname (or lname qname))
   ;; we can dispatch on lnames only because we validate against the DTD,
   ;; which disallows other namespaces.
-  (push (string-or (get-attribute/lname "prefer" attrs) (prefer handler))
+  (push (let ((new (get-attribute/lname "prefer" attrs)))
+          (cond
+            ((equal new "public") :public)
+            ((equal new "system") :system)
+            ((null new) (prefer handler))))
         (prefer-stack handler))
   (push (string-or (get-attribute/lname "base" attrs) (base handler))
         (base-stack handler))
-------------- next part --------------
--- puri-1.3.1.3/src.lisp	2005-11-07 18:39:17.000000000 +0100
+++ puri-1.3.1.3-sbcl/src.lisp	2006-01-09 02:49:01.000000000 +0100
@@ -87,15 +87,13 @@
 (defun shrink-vector (str size)
   #+allegro
   (excl::.primcall 'sys::shrink-svector str size)
-  #+sbcl
-  (sb-kernel:shrink-vector str size)
   #+cmu
   (lisp::shrink-vector str size)
   #+lispworks
   (system::shrink-vector$vector str size)
   #+scl
   (common-lisp::shrink-vector str size)
-  #-(or allegro cmu lispworks sbcl scl)
+  #-(or allegro cmu lispworks scl)
   (setq str (subseq str 0 size))
   str)
 


More information about the cxml-devel mailing list