Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion which library to generate xml with namespaces?

Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.news.ucla.edu!news.usc.edu!news.isi.edu!usenet
From: t...@sevak.isi.edu (Thomas A. Russ)
Newsgroups: comp.lang.lisp
Subject: Re: which library to generate xml with namespaces?
Date: 02 Jul 2010 11:38:36 -0700
Organization: USC Information Sciences Institute
Lines: 42
Sender: t...@blackcat.isi.edu
Message-ID: <ymimxu97mqb.fsf@blackcat.isi.edu>
References: <322bcd11-c308-47e6-b5e4-a6b2387e11d3@f17g2000vbl.googlegroups.com> <82wrtfxxla.fsf@shevek.netfonds.no> <i0kf4l$n48$1@news.eternal-september.org> <82eifmxiu2.fsf@shevek.netfonds.no>
NNTP-Posting-Host: blackcat.isi.edu
Mime-Version: 1.0
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
vertical bars.

  (let* ((csrt (copy-readtable))  
         (*readtable* csrt))
     (setf (readtable-case csrt) :preserve)
     (print (read-from-string "(:digaram :xmlns dia Fred)"))
     (terpri))

  (: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