On Wed, 2003-09-24 at 11:35, Joerg Heinicke wrote:
> Bruno Dumon wrote:
> > On Wed, 2003-09-24 at 00:55, Joerg Heinicke wrote:
> > 
> >>http://www.saxproject.org/?selected=namespaces
> >>
> >>"In addition to those events [correctly used startElement() and 
> >>endElement], SAX2 reports the scope of Namespace declarations using the 
> >>startPrefixMapping and endPrefixMapping methods, so that applications 
> >>can resolve prefixes in attribute values or character data if necessary."
> >>
> >>=> Prefix mappings are not really needed. And it works too :-)
> > 
> > Hmm, I interpret the quoted text differently: it says "SAX2 reports..."
> > and not "SAX2 might or could report ...". There could be transformers
> > down the pipe that depend on this.
> 
> I'm not sure, could be possible if there is a bad transformer ...

huh? Why would such a transformer be bad?

For example, the ZipArchiveSerializer depends on these events.

Also, I think the normal XML serializer depends on them, i.e. if the
namespaces aren't reported using start/endPrefixMapping, the xmlns
attributes will be missing.

> I grepped for 'startPrefixMapping' in Cocoon sources and found it really 
> often, but not all generators have it, e.g. the XMidiGenerator and the 
> DirectoryGenerator.

Then those generators are buggy.

>  For the second one I removed it 3 months ago, nobody 
> complained until now. (It's difficult to search for something that is not 
> there :-) )
> 
> Maybe we should give it a try.

The SAX contract says to announce all namespaces using
start/endPrefixMapping, and I think we should follow that.

>  It makes the handling cleaner and should 
> avoid /unnecessary/ mapping,

why unnecessary?

>  so Cocoon also gains on the performance level.

will be unnoticeable. On the contrary, if you need to know which
namespace prefixes are in scope, you would need to check all
start/endElement events and parse the qName's to extract the prefixes.

> 
> Any comments?

see above.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]                          [EMAIL PROTECTED]

Reply via email to