You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Vadim Gritsenko <va...@verizon.net> on 2003/09/24 00:50:55 UTC

Re: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/generation RequestGenerator.java

joerg@apache.org wrote:

>joerg       2003/09/23 13:39:09
>
>  Modified:    src/java/org/apache/cocoon/generation RequestGenerator.java
>  Log:
>  no need for prefix mapping => removed
>  
>

Why there is no need? AFAIU, it *must* be there, before very first 
start() call. What do I miss?

Vadim



Re: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/generationRequestGenerator.java

Posted by Conny Pemfors <co...@uarda.lu.se>.
Hi sorry about bothering you, have one question though,

in which jar file can I find following:

com.sun.xml.tree.*;

when I want to write my xml files.

kind regards
/Conny

----- Original Message -----
From: "Bruno Dumon" <br...@outerthought.org>
To: <de...@cocoon.apache.org>
Sent: Wednesday, September 24, 2003 9:54 AM
Subject: Re: cvs commit:
cocoon-2.1/src/java/org/apache/cocoon/generationRequestGenerator.java


> 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.
>
> > Joerg
> >
> > Vadim Gritsenko wrote:
> > > joerg@apache.org wrote:
> > >
> > >> joerg       2003/09/23 13:39:09
> > >>
> > >>  Modified:    src/java/org/apache/cocoon/generation
RequestGenerator.java
> > >>  Log:
> > >>  no need for prefix mapping => removed
> > >>
> > >>
> > >
> > > Why there is no need? AFAIU, it *must* be there, before very first
> > > start() call. What do I miss?
> > >
> > > Vadim
> --
> Bruno Dumon                             http://outerthought.org/
> Outerthought - Open Source, Java & XML Competence Support Center
> bruno@outerthought.org                          bruno@apache.org
>


Re: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/generation RequestGenerator.java

Posted by Sylvain Wallez <sy...@anyware-tech.com>.
Joerg Heinicke wrote:

> Carsten Ziegeler wrote:
> Sylvain Wallez wrote:
> Bruno Dumon wrote:
>
> Ok, convinced. I will revert it and add it to the other mentioned 
> generators.
>
>> Furthermore, the ContentHandler.startElement() doc says (see [1]) that
>> xmlns:* attributes are only added if the
>> http://xml.org/sax/features/namespaces-prefixes feature is true.
>
>
> This refers only to the /global/ namespace declarations. The 
> namespaced elements will be also correct, if they have a qname 
> consisting of prefix and local name and the namespace uri set. If I 
> now interpret it correctly the prefix mapping will avoid the namespace 
> declaration on every element.


The qname is also optional and related to the same "namespace-prefixes" 
feature to be true, meaning in most cases, you may only have namespace 
URI and local name.

Most of the code in AbstractTextSerializer is related to an old Xalan 
bug (may have been fixed now) which _required_ the qname to be present 
to correctly serialize.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com



Re: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/generation RequestGenerator.java

Posted by Vadim Gritsenko <va...@verizon.net>.
Joerg Heinicke wrote:

> Carsten Ziegeler wrote:
> Sylvain Wallez wrote:
> Bruno Dumon wrote:
>
> Ok, convinced. I will revert it and add it to the other mentioned 
> generators.
>

Thanks, to everybody :)

Vadim


>> Furthermore, the ContentHandler.startElement() doc says (see [1]) that
>> xmlns:* attributes are only added if the
>> http://xml.org/sax/features/namespaces-prefixes feature is true.
>
>
> This refers only to the /global/ namespace declarations. The 
> namespaced elements will be also correct, if they have a qname 
> consisting of prefix and local name and the namespace uri set. If I 
> now interpret it correctly the prefix mapping will avoid the namespace 
> declaration on every element.
>
> Joerg




Re: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/generation RequestGenerator.java

Posted by Joerg Heinicke <jh...@virbus.de>.
Carsten Ziegeler wrote:
Sylvain Wallez wrote:
Bruno Dumon wrote:

Ok, convinced. I will revert it and add it to the other mentioned generators.

> Furthermore, the ContentHandler.startElement() doc says (see [1]) that
> xmlns:* attributes are only added if the
> http://xml.org/sax/features/namespaces-prefixes feature is true.

This refers only to the /global/ namespace declarations. The namespaced 
elements will be also correct, if they have a qname consisting of prefix and 
local name and the namespace uri set. If I now interpret it correctly the 
prefix mapping will avoid the namespace declaration on every element.

Joerg

-- 
System Development
VIRBUS AG
Fon  +49(0)341-979-7419
Fax  +49(0)341-979-7409
joerg.heinicke@virbus.de
www.virbus.de


Re: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/generation RequestGenerator.java

Posted by Bruno Dumon <br...@outerthought.org>.
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
bruno@outerthought.org                          bruno@apache.org


RE: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/generation RequestGenerator.java

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
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 ...
> 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. 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. It makes the handling cleaner and should
> avoid /unnecessary/ mapping, so Cocoon also gains on the
> performance level.
>
AFAIK, the startPrefixMapping etc. are required. Some other components
really on them! For example, Xalan sometimes (interestingly not always)
requires them to process elements with namespaces correctly. Other
"tools" like some DOMBuilder (building a DOM from a SAX stream) require
them as well.

So I think the correct way is to include them always.

Carsten


Re: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/generation RequestGenerator.java

Posted by Joerg Heinicke <jh...@virbus.de>.
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 ...
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. 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. It makes the handling cleaner and should 
avoid /unnecessary/ mapping, so Cocoon also gains on the performance level.

Any comments?

Joerg

-- 
System Development
VIRBUS AG
Fon  +49(0)341-979-7419
Fax  +49(0)341-979-7409
joerg.heinicke@virbus.de
www.virbus.de


Re: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/generation RequestGenerator.java

Posted by Sylvain Wallez <sy...@anyware-tech.com>.
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.
>

Exactly.

Furthermore, the ContentHandler.startElement() doc says (see [1]) that 
xmlns:* attributes are only added if the 
http://xml.org/sax/features/namespaces-prefixes feature is true.

But it this feature is _false_ by default, meaning 
start/endPrefixMapping are the only way to know where a namespace starts 
and stops (except writing your own namespace-edge detection algorithm).

[1] 
http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html#startElement(java.lang.String, 
java.lang.String, java.lang.String, org.xml.sax.Attributes)

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com



Re: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/generation RequestGenerator.java

Posted by Bruno Dumon <br...@outerthought.org>.
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.

> Joerg
> 
> Vadim Gritsenko wrote:
> > joerg@apache.org wrote:
> > 
> >> joerg       2003/09/23 13:39:09
> >>
> >>  Modified:    src/java/org/apache/cocoon/generation RequestGenerator.java
> >>  Log:
> >>  no need for prefix mapping => removed
> >>  
> >>
> > 
> > Why there is no need? AFAIU, it *must* be there, before very first 
> > start() call. What do I miss?
> > 
> > Vadim
-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Re: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/generation RequestGenerator.java

Posted by Joerg Heinicke <jh...@virbus.de>.
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 :-)

Joerg

Vadim Gritsenko wrote:
> joerg@apache.org wrote:
> 
>> joerg       2003/09/23 13:39:09
>>
>>  Modified:    src/java/org/apache/cocoon/generation RequestGenerator.java
>>  Log:
>>  no need for prefix mapping => removed
>>  
>>
> 
> Why there is no need? AFAIU, it *must* be there, before very first 
> start() call. What do I miss?
> 
> Vadim