[s-xml-devel] support for the xml: namespace

Rudi Schlatte rudi at constantly.at
Sun Nov 20 16:35:08 UTC 2005


[Replying to s-xml-devel as well; trolling for comments on namespaces  
and their Lispy representation..]

On 20. Nov 2005, at 15:38, Sven Van Caekenberghe wrote:

> I applied your patch, but I preferred to not use new-namespace and  
> shortcut the circular dependency by calling make-instance manually  
> for defining *xml-namespace*, like for *local-namespace*.

Ah, I had never thought to try a clean reload of s-xml after making  
my changes... Thanks for applying!

> Have you been using the new namespace support ? Did it work to your  
> expectations ? It is always nice to hear about the users of  
> someone's open source software.

Not for big values of "using" - I'm looking at various xml libraries  
currently, just to get a feel for what's available.  One thing I'm  
not sure about is whether it's a good idea to map namespace prefixes  
to packages.  Consider:

<root>
   <a:foo xmlns:a="http://example.com/ns1" />
   <a:foo xmlns:a="http://example.com/ns2" />
</root>

The two foo elements are different, but a hypothetical element-equal  
function would have to go to very great lengths to determine this  
from the resulting datastructure -- I can think of examples where two  
elements with identical names are be different, and two elements with  
differing parsed names have the same xml name.

I haven't thought this through at all, but I think I'd identify  
elements and attributes by:
- name (always a symbol in the keyword package or a dedicated package)
- namespace (an object, as per register-namespace)
That way, element equality can be determined with two calls to EQ.

I'd keep the namespace prefix used for reading the element/attribute  
for pretty-printing.  (The prefix can't be stored with the namespace,  
since multiple prefixes can simultaneously refer to the same namespace.)

At the moment, this is just idle speculation on my part since I  
haven't used any Lisp xml parser (or indeed, xml) in anger yet, so I  
don't know how much of a problem this is in practice...

Cheers,

Rudi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <https://mailman.common-lisp.net/pipermail/s-xml-devel/attachments/20051120/45cedea8/attachment.sig>


More information about the s-xml-devel mailing list