Message from discussion which library to generate xml with namespaces?
From: t...@sevak.isi.edu (Thomas A. Russ)
Subject: Re: which library to generate xml with namespaces?
Date: 02 Jul 2010 11:38:36 -0700
Organization: USC Information Sciences Institute
References: <email@example.com> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org>
Content-Type: text/plain; charset=us-ascii
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2
"Frode V. Fjeld" <fr...@netfonds.no> writes:
> Rupert Swarbrick <rswarbr...@gmail.com> writes:
> > Does it really give "Diagram" (with this capitalisation)? Wouldn't
> > that be a bug?
> Well.. this behavior happened to fit my requirements at the time. There
> are quite a few ways that can be used to convert :DIAGRAM (or more
> generally :SOME-DIAGRAM) to an XML-ish string (and back). I suppose the
> solution would be to implement and support them all and set behavior per
> namespace. I won't have time for this in the immediate future,
> however. Unless I'll happen to need it..
> BTW I was aiming for a syntax that was convenient to use from the lisp
> side. As opposed to require lisp symbols such ash :|someDiagram| etc.
Unfortunately, xml is case-sensitive, so reading a tag <diagram...> and
turning it into <Diagram...> is an error.
Perhaps the solution would be to use READTABLE-CASE = :PRESERVE when you
read and write the XML. That will give you keywords like :|diagram|,
but generally if READTABLE-CASE is :PRESERVE, it will print without the
(let* ((csrt (copy-readtable))
(setf (readtable-case csrt) :preserve)
(print (read-from-string "(:digaram :xmlns dia Fred)"))
(:digaram :xmlns dia Fred)
(:|digaram| :|xmlns| |dia| |Fred|)
Of course, you will have to use all uppercase for standard lisp names.
An alternative may be to use :INVERT as the readtable case.
Thomas A. Russ, USC/Information Sciences Institute