Re: How to configure TraxProcessor in 2.2?
Javier Puerto <[email protected]> Thu, 5 Dec 2019 16:13:08 +0100
| Newsgroups | gmane.text.xml.cocoon.user |
|---|---|
| Message-ID | <CAACZMNc0WA7EwL37x05F39XSPWCKhLp2Voc8GiBzXSjGpTr2uQ@mail.gmail.com> |
--00000000000096d8110598f65e13
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Hi Mark,
I recommend you to use the Spring configuration. I never had this
requirement before but by the error message and the configuration fragment
that you have sent the NPE is caused because you are not passing an
instance of "org.dspace.saxon.ConfigurableTransformerFactory", you are
passing a String instead.
<property name=3D'transformerFactory'
value=3D'org.dspace.saxon.ConfigurableTransformerFactory'/>
IIRC you should change it to:
<property name=3D'transformerFactory'>
<bean class=3D"org.dspace.saxon.ConfigurableTransformerFactory"/>
</property>
The attribute "value" is for literal values. You can also define the bean
with an ID and then use the attribute "ref" with the ID of the bean.
I hope that helps.
Salu2.
El mi=C3=A9., 4 dic. 2019 a las 22:46, Mark H. Wood (<[email protected]>) esc=
ribi=C3=B3:
> I'm using Cocoon 2.2. I need to pass a custom XSLT transformer
> factory (that wraps Saxon's to configure it) to TraxProcessor, and the
> advice I've found in several places around the Web doesn't seem to be
> working: my factory class never gets instantiated.
>
> I've got a file META-INF/cocoon/avalon/cocoon-core-saxon-xslt.xconf:
>
> <?xml version=3D"1.0" encoding=3D"UTF-8"?>
> <components>
> <component role=3D"org.apache.excalibur.xml.xslt.XSLTProcessor/saxon"
> class=3D"org.apache.cocoon.components.xslt.TraxProcessor">
> <parameter name=3D"use-store" value=3D"true"/>
> <parameter name=3D"transformer-factory"
> value=3D"org.dspace.saxon.ConfigurableTransformerFactory"/=
>
> </component>
> </components>
>
> I also tried copying it to WEB-INF/cocoon and it didnt' seem to work
> there either.
>
> I do have <configurator:settings/> and <avalon:bridge/> in the Spring
> config.
>
> Is there some way to debug component configuration and see if the file
> is even being looked for (and where *is* configuration looking)? The
> Cocoon site directs me to Excalibur, which directs me to Avalon, which
> says that Avalon is wound up and directs me back to Excalibur....
>
>
>
> I've also tried to configure the thing using Spring:
>
> <bean name=3D'org.apache.excalibur.xml.xslt.XSLTProcessor/saxon'
> class=3D'org.apache.cocoon.components.xslt.TraxProcessor'
> init-method=3D'initialize'
> destroy-method=3D'dispose'>
> <!--property name=3D'use-store' value=3D'true'/-->
> <property name=3D'transformerFactory'
> value=3D'org.dspace.saxon.ConfigurableTransformerFactory'=
/>
> </bean>
>
> but so far I'm missing something: TraxProcessor.sourceToSAX throws an
> NPE. I'm probably not setting the parameters correctly -- there isn't
> a setter for use-store at all, for example.
>
> I've found any number of pages that tell me Avalon configuration is
> being replaced by Spring, but nothing practical on how to convert
> Avalon configuration (such as the first sample above) to Spring, or
> even how to write fresh Spring configuration for Cocoon components.
> It would be nice to know how to do this even if I wind up using the
> Avalon approach with the present task.
>
> --
> Mark H. Wood
> Lead Technology Analyst
>
> University Library
> Indiana University - Purdue University Indianapolis
> 755 W. Michigan Street
> Indianapolis, IN 46202
> 317-274-0749
> www.ulib.iupui.edu
>
--00000000000096d8110598f65e13
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Hi Mark,</div><div><br></div><div>I recommend you to =
use the Spring configuration. I never had this requirement before but by th=
e error message and the configuration fragment that you have sent the NPE i=
s caused because you are not passing an instance of "org.dspace.saxon.=
ConfigurableTransformerFactory", you are passing a String instead.</di=
v><div><br></div><div><property name=3D'transformerFactory'<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 value=3D'org.ds=
pace.saxon.ConfigurableTransformerFactory'/><br></div><div><br></div=
><div>IIRC you should change it to:</div><div><property name=3D'tran=
sformerFactory'><br></div><div>=C2=A0 <bean class=3D"org.dsp=
ace.saxon.ConfigurableTransformerFactory"/></div><div></property=
></div><div><br></div><div>The attribute "value" is for litera=
l values. You can also define the bean with an ID and then use the attribut=
e "ref" with the ID of the bean.</div><div>I hope that helps.</di=
v><div><br></div><div>Salu2.</div><div><br></div><div class=3D"gmail_quote"=
><div dir=3D"ltr" class=3D"gmail_attr">El mi=C3=A9., 4 dic. 2019 a las 22:4=
6, Mark H. Wood (<<a href=3D"mailto:[email protected]">[email protected]</a>=
>) escribi=C3=B3:<br></div><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:=
1ex">I'm using Cocoon 2.2.=C2=A0 I need to pass a custom XSLT transform=
er<br>
factory (that wraps Saxon's to configure it) to TraxProcessor, and the<=
br>
advice I've found in several places around the Web doesn't seem to =
be<br>
working:=C2=A0 my factory class never gets instantiated.<br>
<br>
I've got a file META-INF/cocoon/avalon/cocoon-core-saxon-xslt.xconf:<br=
>
<br>
<?xml version=3D"1.0" encoding=3D"UTF-8"?><br>
<components><br>
=C2=A0 <component role=3D"org.apache.excalibur.xml.xslt.XSLTProcess=
or/saxon"<br>
=C2=A0 =C2=A0 class=3D"org.apache.cocoon.components.xslt.TraxProcessor=
"><br>
=C2=A0 =C2=A0 <parameter name=3D"use-store" value=3D"true=
"/><br>
=C2=A0 =C2=A0 <parameter name=3D"transformer-factory"<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0value=3D"org.ds=
pace.saxon.ConfigurableTransformerFactory"/><br>
=C2=A0 </component><br>
</components><br>
<br>
I also tried copying it to WEB-INF/cocoon and it didnt' seem to work<br=
>
there either.<br>
<br>
I do have <configurator:settings/> and <avalon:bridge/> in the =
Spring<br>
config.<br>
<br>
Is there some way to debug component configuration and see if the file<br>
is even being looked for (and where *is* configuration looking)?=C2=A0 The<=
br>
Cocoon site directs me to Excalibur, which directs me to Avalon, which<br>
says that Avalon is wound up and directs me back to Excalibur....<br>
<br>
<br>
<br>
I've also tried to configure the thing using Spring:<br>
<br>
=C2=A0 =C2=A0 <bean name=3D'org.apache.excalibur.xml.xslt.XSLTProces=
sor/saxon'<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 class=3D'org.apache.cocoon.component=
s.xslt.TraxProcessor'<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 init-method=3D'initialize'<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 destroy-method=3D'dispose'><b=
r>
=C2=A0 =C2=A0 =C2=A0 <!--property name=3D'use-store' value=3D=
9;true'/--><br>
=C2=A0 =C2=A0 =C2=A0 <property name=3D'transformerFactory'<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 value=3D'org.ds=
pace.saxon.ConfigurableTransformerFactory'/><br>
=C2=A0 =C2=A0 </bean><br>
<br>
but so far I'm missing something:=C2=A0 TraxProcessor.sourceToSAX throw=
s an<br>
NPE.=C2=A0 I'm probably not setting the parameters correctly -- there i=
sn't<br>
a setter for use-store at all, for example.<br>
<br>
I've found any number of pages that tell me Avalon configuration is<br>
being replaced by Spring, but nothing practical on how to convert<br>
Avalon configuration (such as the first sample above) to Spring, or<br>
even how to write fresh Spring configuration for Cocoon components.<br>
It would be nice to know how to do this even if I wind up using the<br>
Avalon approach with the present task.<br>
<br>
-- <br>
Mark H. Wood<br>
Lead Technology Analyst<br>
<br>
University Library<br>
Indiana University - Purdue University Indianapolis<br>
755 W. Michigan Street<br>
Indianapolis, IN 46202<br>
317-274-0749<br>
<a href=3D"http://www.ulib.iupui.edu" rel=3D"noreferrer" target=3D"_blank">=
www.ulib.iupui.edu</a><br>
</blockquote></div></div>
--00000000000096d8110598f65e13--