You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by vdhawan <va...@gmail.com> on 2014/07/24 12:17:04 UTC
XSLT transformation produces junk charachters
Hello,
In my camel context, i invoke a java bean (which does some processing) and
returns the body in the exchange. So far so good.
<from uri:file://blablba>
<bean ref="myBean" />
<log message="${body}"></log>
<convertBodyTo type="String"/>
<to uri="xslt:Myxslt.xslt" />
<log message="${body}"></log>
The second log message prints shows the XSLT transformation results in some
junk charachters like </></></> and i can see an error in the logs
javax.xml.transform.TransformerException: Unexpected character ' ' (code 32)
in content after '<' (malformed start element?).
Running the transformation file a stand alone transformation produces
expected results, its only when running on OSGi, that it fails.
My pom includes the following
camel-core
camel-spring
cxf-rt-transports-http
cxf-rt-frontend-jaxws
Saxon-HE (9.0.4)
Camel version is 2.12
--
View this message in context: http://camel.465427.n5.nabble.com/XSLT-transformation-produces-junk-charachters-tp5754357.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: XSLT transformation produces junk charachters
Posted by vdhawan <va...@gmail.com>.
Fixed it finally.
I did not intend to use xalan for my transformations however Fuse was being
forced to use this because of one the dependencies in my pom Saxon-HE.
I upgraded to 9.5.1.1, and the maven dependency tree depicted that it no
longer depended on xalan.
I then used ?saxon=ture in my camel route just to make sure saxon is used.
--
View this message in context: http://camel.465427.n5.nabble.com/XSLT-transformation-produces-junk-charachters-tp5754357p5754396.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: XSLT transformation produces junk charachters
Posted by vdhawan <va...@gmail.com>.
Bingo!! Exactly what i am facing. .
I am using camel 2.12.
As per the bug definition, this issue is a known issue for Xalan 2.7.1.
Just checked my maven dependency tree, i can see
*xalan:xalan:jar:2.7.0:compile*
net.sf.saxon:Saxon-HE:jar:9.4:compile
[INFO] | +- org.jdom:jdom:jar:1.1:compile
[INFO] | +- xom:xom:jar:1.2.5:compile
[INFO] | | +- xml-apis:xml-apis:jar:1.3.03:compile
[INFO] | | +- xerces:xercesImpl:jar:2.8.0:compile
[INFO] | | | \- (xml-apis:xml-apis:jar:1.3.03:compile - omitted for
duplicate)
[INFO] | | \- xalan:xalan:jar:2.7.0:compile
[INFO] | | \- (xml-apis:xml-apis:jar:1.0.b2:compile - omitted for
conflict with 1.3.03)
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | \- (xml-apis:xml-apis:jar:1.0.b2:compile - omitted for conflict
with 1.3.03)
[INFO] | \- (xml-resolver:xml-resolver:jar:1.2:compile - omitted for
duplicate)
Thanks
--
View this message in context: http://camel.465427.n5.nabble.com/XSLT-transformation-produces-junk-charachters-tp5754357p5754384.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: XSLT transformation produces junk charachters
Posted by Grzegorz Grzybek <gr...@gmail.com>.
Hello
See this issue in CAMEL: https://issues.apache.org/jira/browse/CAMEL-7424
and this issue in CXF: https://issues.apache.org/jira/browse/CXF-5733
What version of Camel do you use?
regards
Grzegorz Grzybek
2014-07-24 14:34 GMT+02:00 vdhawan <va...@gmail.com>:
> Thanks again Franz.
>
> Debugged a little bit more and it doesnt look like a type conversion issue.
>
> If i pass just tinker with input xml to the xslt, it works in some cases.
>
> More specifically *does not* work and <ns:A xmlns:ns="http://mynamespace
> >
> works.
>
> P.S - I am using xsl:copy-of select=*node()|@* in my XSLT.
>
> Is there a way i can i find out which processor is being used to do the XSL
> transformation (or i can ask it to use a specific processor). Then i can
> try
> to replicate this is in a stand alone app and go from there.
>
>
> Thanks
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/XSLT-transformation-produces-junk-charachters-tp5754357p5754379.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: XSLT transformation produces junk charachters
Posted by vdhawan <va...@gmail.com>.
Thanks again Franz.
Debugged a little bit more and it doesnt look like a type conversion issue.
If i pass just tinker with input xml to the xslt, it works in some cases.
More specifically *does not* work and <ns:A xmlns:ns="http://mynamespace>
works.
P.S - I am using xsl:copy-of select=*node()|@* in my XSLT.
Is there a way i can i find out which processor is being used to do the XSL
transformation (or i can ask it to use a specific processor). Then i can try
to replicate this is in a stand alone app and go from there.
Thanks
--
View this message in context: http://camel.465427.n5.nabble.com/XSLT-transformation-produces-junk-charachters-tp5754357p5754379.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: XSLT transformation produces junk charachters
Posted by Franz Paul Forsthofer <em...@googlemail.com>.
Hi,
then you should try to find out how the DOMSource is transformed to
String. I guess it is transfomed first to a Stream and then to String.
In this case you need the correct encoding.
Regards Franz
On Thu, Jul 24, 2014 at 2:02 PM, vdhawan <va...@gmail.com> wrote:
> Thanks for response Franz.
>
> Bean returns an object of javax.xml.transform.Source.
>
> Source s = new DOMSource(myObj)
> exchange.getOut().setBody(s);
>
> Thanks
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/XSLT-transformation-produces-junk-charachters-tp5754357p5754366.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
Re: XSLT transformation produces junk charachters
Posted by vdhawan <va...@gmail.com>.
Thanks for response Franz.
Bean returns an object of javax.xml.transform.Source.
Source s = new DOMSource(myObj)
exchange.getOut().setBody(s);
Thanks
--
View this message in context: http://camel.465427.n5.nabble.com/XSLT-transformation-produces-junk-charachters-tp5754357p5754366.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: XSLT transformation produces junk charachters
Posted by Franz Paul Forsthofer <em...@googlemail.com>.
Hi,
what format does return the bean, if it is a byte array or stream then
you have to specify the encoding in the <convertBodyTo type="String"/>
step:<convertBodyTo type="String" charset="your encdong" />
Regards Franz
On Thu, Jul 24, 2014 at 12:17 PM, vdhawan <va...@gmail.com> wrote:
> Hello,
>
> In my camel context, i invoke a java bean (which does some processing) and
> returns the body in the exchange. So far so good.
>
> <from uri:file://blablba>
> <bean ref="myBean" />
> <log message="${body}"></log>
> <convertBodyTo type="String"/>
> <to uri="xslt:Myxslt.xslt" />
> <log message="${body}"></log>
>
> The second log message prints shows the XSLT transformation results in some
> junk charachters like </></></> and i can see an error in the logs
> javax.xml.transform.TransformerException: Unexpected character ' ' (code 32)
> in content after '<' (malformed start element?).
>
> Running the transformation file a stand alone transformation produces
> expected results, its only when running on OSGi, that it fails.
>
> My pom includes the following
> camel-core
> camel-spring
> cxf-rt-transports-http
> cxf-rt-frontend-jaxws
> Saxon-HE (9.0.4)
>
> Camel version is 2.12
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/XSLT-transformation-produces-junk-charachters-tp5754357.html
> Sent from the Camel - Users mailing list archive at Nabble.com.