Subject: Re: XML and lisp
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 27 Aug 2001 08:17:41 GMT
Newsgroups: comp.lang.lisp
Message-ID: <9mcvn5$eh87a$1@fido.engr.sgi.com>
Kent M Pitman  <pitman@world.std.com> wrote:
+---------------
| rpw3@rigden.engr.sgi.com (Rob Warnock) writes:
| > 2. Force attribute names and element names into different packages, e.g.:
| > 	(foo (attr:bar 1) (bar 2))
| >    or if the current package is never the keyword package, simply:
| > 	(foo (:bar 1) (bar 2))
| 
| Don't forget XML has a package namespace of its own.  You'd need nested
| namespaces to pull this off, no?
+---------------

Oh, heavens! I certainly wasn't trying to open *that* can of worms again!
But yes, you're right, of course, if one were to try to use Lisp namespaces
directly for XML names. But...

I think Erik's parallel response gets it absolutely correct [which I
missed on first reading of his earlier article -- oops!], namely, once
parsed (and defaulted, if necessary) all the stuff about what's an
"attribute" and what's not should be a property of the Lisp representation
of the element [CLOS class, whatever], and not necessarily encoded
in any way in the Lisp data structure per se.

Likewise, I suspect the right answer for dealing with XML namespaces
will turn out to be to have the Lisp representation of each element
worry about that, and use directly-corresponding names for XML elements
and Lisp symbols only to the extent that it's convenient, and *NOT*
attempt to force any rigid or automatic 1-to-1 correspondence.

I was intending to use Lisp packages only to encode the one bit of
"attribute/non-attribute", not encode XML namespace, but Erik rightly
showed that approach was still trapped in the SGML/XML worldview. Hence,
I retract the suggestion (except in the case that the Lisp representation
of a particular element *chooses* to use that distinction, purely for
its own convenience).


-Rob

-----
Rob Warnock, 30-3-510		<rpw3@sgi.com>
SGI Network Engineering		<http://reality.sgi.com/rpw3/>
1600 Amphitheatre Pkwy.		Phone: 650-933-1673
Mountain View, CA  94043	PP-ASEL-IA