[cxml-devel] Catalog problems
David Lichteblau
david at lichteblau.com
Mon Jan 9 00:14:11 UTC 2006
Quoting Adam C. Emerson (aemerson at acm.org):
> I've been trying to use the CXML catalog feature, but so far I haven't
> had any success. Is there something that I am doing that is obviously
> wrong?
No, that catalog file looks fine. This is obviously an under-tested
feature in CXML...
Three issues:
1. The catalog spec demands that errors encountered while parsing the
catalog file are to be ignored, thereby obscuring problem #2.
2. The catalog format is specified with Schema (for namespace
support), not actually with a DTD. Since CXML doesn't have Schema
support yet, I decided back then to validate against the DTD instead,
against the advice to the contrary in the spec. I should have have
known better -- your file fails DTD validation despite probably
being correct (due to the extra namespace declarations not allowed
by the DTD).
3. And then there's also an obvious bug in <group> handling in CXML...
Can you try the attached patch? It disables validation (more of a
workaround than a solution, but probably better than nothing for now)
and fixes bug #3.
Thanks,
David
-------------- next part --------------
Index: catalog.lisp
===================================================================
RCS file: /project/cxml/cvsroot/cxml/xml/catalog.lisp,v
retrieving revision 1.1.1.16
diff -u -r1.1.1.16 catalog.lisp
--- catalog.lisp 13 Mar 2005 18:02:56 -0000 1.1.1.16
+++ catalog.lisp 9 Jan 2006 00:03:29 -0000
@@ -222,8 +222,9 @@
(defun parse-catalog-file (uri)
(handler-case
(parse-catalog-file/strict uri)
- (file-error () nil)
- (parser-error () nil)))
+ ((or file-error parser-error) (c)
+ (warn "ignoring catalog error: ~A" c)
+ nil)))
(defparameter *catalog-dtd*
(let* ((cxml
@@ -250,7 +251,7 @@
(parse-stream s
(make-recoder (make-instance 'catalog-parser :uri uri)
#'rod-to-utf8-string)
- :validate t
+ :validate nil
:dtd (make-extid nil dtd-sysid)
:root #"catalog"
:entity-resolver #'entity-resolver)))))
@@ -284,7 +285,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))
More information about the cxml-devel
mailing list