[Expat-discuss] XML_ParserCreateNS

Karl Waclawek karl at waclawek.net
Mon Dec 20 03:36:43 CET 2004



Fred L. Drake, Jr. wrote:
> On Monday 13 December 2004 15:18, Karl Waclawek wrote:
>  > Can you think of any use case for having the separator omitted?
>  > Fred, if you read this - do you remember why this feature
>  > was provided?
> 
> This is for RDF users.  RDF/XML has a very weird intepretation of namespace, 
> likely stemming from the RDF crowd's convention of ending namespace URIs with 
> the "#" character.  The namespace URI and the local name are simply jammed 
> together.  So the following two elements should both have a "fuill name" of 
> 'http://xml.example.org/foo':
> 
>     <foo xmlns="http://xml.example.org/" />
> 
>     <o xmlns="http://xml.example.org/fo" />
> 
> While I'm of the mind that this is insane, that is what the RDF/XML specs say 
> must be done.  We should keep the special case for a namespace separator of 
> '\0' and fix anyplace this is handled according to the documentation.

OK, so we keep it to allow RDF processors to skip an extra step of
uri+localName concatenation, as we are all about performance, right?
There is probably a bug in the attribute name generation, where it does not 
deal with this special case. I may have introduced this bug when I fixed
the bug of Expat not detecting duplicate attributes with different prefixes.

However, I really would like to change the name reporting for post 2.0 
releases to pass uri, localName and prefix as three separate arguments,
especially since we already have them available. Building the current
name argument using separators is just extra work for Expat.
For RDF processor there would then be the extra string concatenation
mentioned above, but this would be offset by what we gain in Expat.

> We should also document that this should not be combined with namespace 
> triplets.  That's a programmer error; we don't actually need to catch that 
> case and return an error code; we need not to segfault.

I don't think we segfault currently, do we?

>  > This makes no sense to me either - when namespace processing is
>  > turned on - as the parser would then not conform to the namespaces
>  > specification, if I remember correctly.
> 
> Agreed.  Expat used to do that, but we determined that was wrong after we'd 
> read the spec enough times.
> 
>  > So, I suggest two steps:
>  > - modify namespace separator code as above and adjust comments/docs
> 
> -1, as discussed above.
> 
>  > - remove the sentence above from the comments/docs
> 
> +1.


OK, for now.  ;-)

Karl


More information about the Expat-discuss mailing list