[cxml-devel] Bugs in namespace parsing.

Peder Chr. Nørgaard pcn at pogt.dk
Tue May 22 12:22:30 UTC 2007


On Tuesday 22 May 2007, David Lichteblau wrote:
> Quoting Peder Chr. N?rgaard (pcn at pogt.dk):
> > There seems to be not one, but two problems.  First, the parser or the
> > builder ignores the rule that the scope of an xmlns attribute starts
> > from the tag of the element in which it is included.  Second, (and
> > that is probably the builder) fail to apply the default namespace to
> > internal elements.
>
> The XML parser implements namespace handling correctly.
>
> The XMLS-compatible builder is incorrect, because it is immitating XMLS
> behaviour.
>
> If I may quote from my own documentation:
>
> 	fixme: It is unclear to me how namespaces are meant to work in
> 	xmls, since xmls documentation differs from how xmls actually
> 	works in current releases. Usually applications need to know
> 	both the namespace prefix and the namespace URI. We currently
> 	follow the xmls implementation and use the namespace prefix
> 	instead of following its documentation which shows the URI. We
> 	do not follow xmls in munging xmlns attribute values.
> 	Attributes themselves have namespaces and it is not clear to me
> 	how that works in xmls.

Thanks for your answer.  That is all good news.

>
> > FYI, XMLS has the approximately the same kind of bug.  So has the PXML
> > suite from Franz.  It is evidently something that is a bit tough to get
> > right. Maybe because it involves two scans of a <> construction - you
> > really don't know the namespace of tags and attributes until you have
> > parsed the entire <> construction and located the zero-or-one "xmlns="
> > and the
> > zero-one-or-many "xmlns:<name>=" attributes.
>
> Based on CXML's SAX parser, tt is not hard at all to write a builder
> with correct namespace support, you just have to pick the format you
> want and implement it.  The SAX parser already does all namespace
> processing, so the events SAX:START-ELEMENT and SAX:END-ELEMENT include
> all necessary information, as separate arguments (or slots in the case
> of the attributes).
>
> The XMLS builder source code in CXML is also meant as copy&paste
> material in this regard, because it is a simple SAX handler that can
> easily be adapted.

Building another builder sounds like a winner for my purpose.  Actually, I 
would then rather to to emulate the builder of Franz's xml parser (without 
the bug, that is!).  
>
>
> In fact, Edi Weitz has already done exactly that.  Download CL-WEBDAV
> (http://weitz.de/cl-webdav/) and have a look at xml.lisp in that
> tarball.  As Edi writes on his page:
>
> 	We're representing XML as XMLS nodes which are very similar to
> 	CXML's XMLS nodes but try to get namespaces right because they
> 	don't purport to be compatible with XMLS
>
> Apparently there is some WebDav specific code in xml.lisp, but that
> should be easy to remove.

I will look into that, too.

Thanks for your answer.

best regards

-- 
Peder Chr. Nørgaard     e-mail: pcn at pogt.dk
Gefionsvej 19           spejder-e-mail: hathi at gallerne.dk
DK-8230 Åbyhøj          tel: +45 87 44 11 99
Denmark                 mob: +45 30 91 84 31



More information about the cxml-devel mailing list