cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <>
Subject Re: Character escaping problem with custom generator
Date Sun, 30 Mar 2008 18:34:20 GMT
On 30.03.2008 13:32, shai200 wrote:

> Are you referring to org.apache.cocoon.core.xml.impl.JaxpSAXParser ?

Its interface org.apache.cocoon.core.xml.SAXParser. But I see that's the 
code that has actually changed with 2.2, there is no longer a ROLE. 
Instead it now uses the getClass().getName() directly:

(SAXParser) this.manager.lookup(SAXParser.class.getName());

Following FileGenerator sample it's also possible to set it up using 
Spring (injecting the parser). For the FileGenerator it looks like

   <bean name="org.apache.cocoon.generation.Generator/file"
     <pipeline:component label="content"/>
     <property name="parser" ref="org.apache.cocoon.core.xml.SAXParser"/>

(Taken from cocoon-core-generators.xml.)

> I don't use a ServiceManager, but what if I instantiate the parser every
> time? Will performance be low? And if I were to use the ServiceManager,
> where would I store it? On the application level?

Originally I recommended to extend ServiceableGenerator. There it is 
already available (field name is manager).

> Also, should I still startDocument and endDocument like so? 
> contentHandler.startDocument();
> 			contentHandler.startElement("", "content", "content", emptyAttr);
> 				parser.parse(is, contentHandler);
> 			contentHandler.endElement("","content","content");
> 			contentHandler.endDocument();
> Or should I just ignore starting and ending the document, manually put the
> <content> tag in my original xhtml String and jst parse the monster?

Except for the startDocument() and endDocument() calls this does not 
really matter. For the document calls I'm not quite sure if parsing a 
string generates them - and if it does and you already have them if 
that's causing a problem. I would just try it out.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message