You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by rhuiser <ro...@gmail.com> on 2012/09/29 09:43:44 UTC
How to indent output of an qxuery transformation
Greetings all,
I would like the output of my xquery transformation to be indented (it is
now a single line which is hard to read by humans).
I am using:
<to uri="xquery:openTermDepositRequest.xquery"/>
..are there parameters/options I can add?
Thanks in advance,
Robin Huiser
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-indent-output-of-an-qxuery-transformation-tp5720230.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to indent output of an qxuery transformation
Posted by rhuiser <ro...@gmail.com>.
Super!!!!!
Thanks so much!!!!
Robin
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-indent-output-of-an-qxuery-transformation-tp5720230p5720276.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to indent output of an qxuery transformation
Posted by Babak Vahdat <ba...@swissonline.ch>.
<camelContext id="..." xmlns="http://camel.apache.org/schema/spring">
<properties>
<property key="org.apache.camel.xmlconverter.output.indent"
value="yes"/>
</properties>
...
...
</camelContext>
Babak
rhuiser wrote
> Hi all,
>
> Thanks for your help! This is what I've been searching for!
> One little question:
>
> How can i put this camel context property using the XML DSL?
>
> Thanks again,
> Robin
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-indent-output-of-an-qxuery-transformation-tp5720230p5720271.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to indent output of an qxuery transformation
Posted by rhuiser <ro...@gmail.com>.
Hi all,
Thanks for your help! This is what I've been searching for!
One little question:
How can i put this camel context property using the XML DSL?
Thanks again,
Robin
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-indent-output-of-an-qxuery-transformation-tp5720230p5720270.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to indent output of an qxuery transformation
Posted by Claus Ibsen <cl...@gmail.com>.
On Sun, Sep 30, 2012 at 12:06 PM, Raul Kripalani <ra...@evosent.com> wrote:
> Hi Claus,
>
> I would say no. Automatic pretty print interferes with log files, forcing
> log statements to become multiline.
>
If you enable CXF logging then its SOAP content is multiline.
And IMHO its not good practice to log message content in production
logs (sensitive information being open to dev-ops).
> And it also interferes with systems that parse XML via plaintext string
> functions.
>
Parsing XML you would need to take account for whitespace noise. There
is no validation that would forbid whitespace in an XML document. So
anyone parsing XML would need to take that into account.
> Instead, I propose that we document this feature better in a FAQ and link
> to it from the XML-related doc pages.
>
Yes docs for current behavior and how to fix this is a good idea.
> As a side note, in XSLT pretty print is enabled via the 'indent' attribute
> of the xsl:output instruction. In practice, you also need to set
> xsl:strip-space to star (*).
>
Yeah but a lot of people are not XSLT ninjas. They are looking for an
easy to use option on the Camel component: prettyPrint=true|false. Or
whatever name the option is.
And with an option on the Camel components, people can control this
more fine grained, instead of some JVM level system property (that is
hard to adjust on a production server), or a context level property on
CamelContext that affects the entire Camel context.
> Regards,
> Raúl.
>
> Sent from a mobile device
> On Sep 30, 2012 10:46 AM, "Claus Ibsen" <cl...@gmail.com> wrote:
>
>> On Sat, Sep 29, 2012 at 9:54 PM, Babak Vahdat
>> <ba...@swissonline.ch> wrote:
>> > Hi
>> >
>> > Welcome to the Camel community!
>> >
>> > The solution to your problem (as Claus has already mentioned it) is to
>> add a
>> > property, that's:
>> >
>> >
>> >
>> myCamelContext.getProperties().put("org.apache.camel.xmlconverter.output.indent",
>> > "yes");
>> >
>>
>> Maybe we should consider this by default? Most people want the XML to
>> be nicely outputted.
>>
>>
>> > At very beginning *before* you start routing (believe me as I've already
>> > tested it :-)).
>> >
>> > The "point" is that the default properties the Camel's own XmlConverter
>> uses
>> > (that's org.apache.camel.converter.jaxp.XmlConverter) does not add the
>> > following property:
>> >
>> > properties.put(OutputKeys.INDENT, "yes");
>> >
>> > To the defaults (see the method defaultOutputProperties() of it).
>> >
>> > So that we do this by ourselves as the value of the constant
>> > "javax.xml.transform.OutputKeys.INDENT" is equal "indent".
>> >
>> > More elegantly you could also make use of Camel's Property component to
>> set
>> > this property (instead of the one liner above):
>> > http://camel.apache.org/properties.html
>> >
>> > Babak
>> > PS: The underlying XQuery engine of Camel is Saxon which uses three
>> spaces
>> > for indention *if* you ask it to do so.
>> >
>> >
>> > rhuiser wrote
>> >> Greetings all,
>> >>
>> >> I would like the output of my xquery transformation to be indented (it
>> is
>> >> now a single line which is hard to read by humans).
>> >>
>> >> I am using:
>> >> <to uri="xquery:openTermDepositRequest.xquery"/>
>> >> ..are there parameters/options I can add?
>> >>
>> >> Thanks in advance,
>> >> Robin Huiser
>> >
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://camel.465427.n5.nabble.com/How-to-indent-output-of-an-qxuery-transformation-tp5720230p5720245.html
>> > Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> FuseSource is now part of Red Hat
>> Email: cibsen@redhat.com
>> Web: http://fusesource.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>>
--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Re: How to indent output of an qxuery transformation
Posted by Raul Kripalani <ra...@evosent.com>.
Hi Claus,
I would say no. Automatic pretty print interferes with log files, forcing
log statements to become multiline.
And it also interferes with systems that parse XML via plaintext string
functions.
Instead, I propose that we document this feature better in a FAQ and link
to it from the XML-related doc pages.
As a side note, in XSLT pretty print is enabled via the 'indent' attribute
of the xsl:output instruction. In practice, you also need to set
xsl:strip-space to star (*).
Regards,
Raúl.
Sent from a mobile device
On Sep 30, 2012 10:46 AM, "Claus Ibsen" <cl...@gmail.com> wrote:
> On Sat, Sep 29, 2012 at 9:54 PM, Babak Vahdat
> <ba...@swissonline.ch> wrote:
> > Hi
> >
> > Welcome to the Camel community!
> >
> > The solution to your problem (as Claus has already mentioned it) is to
> add a
> > property, that's:
> >
> >
> >
> myCamelContext.getProperties().put("org.apache.camel.xmlconverter.output.indent",
> > "yes");
> >
>
> Maybe we should consider this by default? Most people want the XML to
> be nicely outputted.
>
>
> > At very beginning *before* you start routing (believe me as I've already
> > tested it :-)).
> >
> > The "point" is that the default properties the Camel's own XmlConverter
> uses
> > (that's org.apache.camel.converter.jaxp.XmlConverter) does not add the
> > following property:
> >
> > properties.put(OutputKeys.INDENT, "yes");
> >
> > To the defaults (see the method defaultOutputProperties() of it).
> >
> > So that we do this by ourselves as the value of the constant
> > "javax.xml.transform.OutputKeys.INDENT" is equal "indent".
> >
> > More elegantly you could also make use of Camel's Property component to
> set
> > this property (instead of the one liner above):
> > http://camel.apache.org/properties.html
> >
> > Babak
> > PS: The underlying XQuery engine of Camel is Saxon which uses three
> spaces
> > for indention *if* you ask it to do so.
> >
> >
> > rhuiser wrote
> >> Greetings all,
> >>
> >> I would like the output of my xquery transformation to be indented (it
> is
> >> now a single line which is hard to read by humans).
> >>
> >> I am using:
> >> <to uri="xquery:openTermDepositRequest.xquery"/>
> >> ..are there parameters/options I can add?
> >>
> >> Thanks in advance,
> >> Robin Huiser
> >
> >
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/How-to-indent-output-of-an-qxuery-transformation-tp5720230p5720245.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cibsen@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>
Re: How to indent output of an qxuery transformation
Posted by Claus Ibsen <cl...@gmail.com>.
On Sat, Sep 29, 2012 at 9:54 PM, Babak Vahdat
<ba...@swissonline.ch> wrote:
> Hi
>
> Welcome to the Camel community!
>
> The solution to your problem (as Claus has already mentioned it) is to add a
> property, that's:
>
>
> myCamelContext.getProperties().put("org.apache.camel.xmlconverter.output.indent",
> "yes");
>
Maybe we should consider this by default? Most people want the XML to
be nicely outputted.
> At very beginning *before* you start routing (believe me as I've already
> tested it :-)).
>
> The "point" is that the default properties the Camel's own XmlConverter uses
> (that's org.apache.camel.converter.jaxp.XmlConverter) does not add the
> following property:
>
> properties.put(OutputKeys.INDENT, "yes");
>
> To the defaults (see the method defaultOutputProperties() of it).
>
> So that we do this by ourselves as the value of the constant
> "javax.xml.transform.OutputKeys.INDENT" is equal "indent".
>
> More elegantly you could also make use of Camel's Property component to set
> this property (instead of the one liner above):
> http://camel.apache.org/properties.html
>
> Babak
> PS: The underlying XQuery engine of Camel is Saxon which uses three spaces
> for indention *if* you ask it to do so.
>
>
> rhuiser wrote
>> Greetings all,
>>
>> I would like the output of my xquery transformation to be indented (it is
>> now a single line which is hard to read by humans).
>>
>> I am using:
>> <to uri="xquery:openTermDepositRequest.xquery"/>
>> ..are there parameters/options I can add?
>>
>> Thanks in advance,
>> Robin Huiser
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-indent-output-of-an-qxuery-transformation-tp5720230p5720245.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Re: How to indent output of an qxuery transformation
Posted by Babak Vahdat <ba...@swissonline.ch>.
Hi
Welcome to the Camel community!
The solution to your problem (as Claus has already mentioned it) is to add a
property, that's:
myCamelContext.getProperties().put("org.apache.camel.xmlconverter.output.indent",
"yes");
At very beginning *before* you start routing (believe me as I've already
tested it :-)).
The "point" is that the default properties the Camel's own XmlConverter uses
(that's org.apache.camel.converter.jaxp.XmlConverter) does not add the
following property:
properties.put(OutputKeys.INDENT, "yes");
To the defaults (see the method defaultOutputProperties() of it).
So that we do this by ourselves as the value of the constant
"javax.xml.transform.OutputKeys.INDENT" is equal "indent".
More elegantly you could also make use of Camel's Property component to set
this property (instead of the one liner above):
http://camel.apache.org/properties.html
Babak
PS: The underlying XQuery engine of Camel is Saxon which uses three spaces
for indention *if* you ask it to do so.
rhuiser wrote
> Greetings all,
>
> I would like the output of my xquery transformation to be indented (it is
> now a single line which is hard to read by humans).
>
> I am using:
> <to uri="xquery:openTermDepositRequest.xquery"/>
> ..are there parameters/options I can add?
>
> Thanks in advance,
> Robin Huiser
--
View this message in context: http://camel.465427.n5.nabble.com/How-to-indent-output-of-an-qxuery-transformation-tp5720230p5720245.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to indent output of an qxuery transformation
Posted by Claus Ibsen <cl...@gmail.com>.
On Sat, Sep 29, 2012 at 9:43 AM, rhuiser <ro...@gmail.com> wrote:
> Greetings all,
>
> I would like the output of my xquery transformation to be indented (it is
> now a single line which is hard to read by humans).
>
> I am using:
>
> <to uri="xquery:openTermDepositRequest.xquery"/>
>
> ..are there parameters/options I can add?
>
I am not sure. JAXB has a pretty print option. So I wonder if there
is something a like for xpath / xqury / xslt etc.
Feel free to dive into it. I would assume there is maybe some property
you can configure to use pretty output.
> Thanks in advance,
> Robin Huiser
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-indent-output-of-an-qxuery-transformation-tp5720230.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen