You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Carsten Schlipf <ca...@hp.com> on 2006/11/07 17:42:41 UTC
Content of incoming message is of type StreamSource instead of
DOMSource
Hi all,
I have used some snapshot releases of ServiceMix prior to the official 3.0
release. Previously all standard components provided a DOMSource instance of
the message, when I called getContent() on the incoming normalized message.
Starting with 3.0 this seems to have changed. Suddenly I get a StreamSource
(or StringSource) representation of the message. Using getText() on this
StreamSource, I get a String representation of the XML document, which must
be parsed into a DOM document, before I can continue processing the XML
content. This is even the case, if the sending component explicitely puts a
DOMSource object in its outgoing message.
I wonder what's the reason behind this change. To me it seems to be somewhat
of an overhead to transform a DOMSource to a StreamSource just to parse this
StreamSource into a DOM tree in the next component again.
I haven't found anything regarding this using Google or searching this
forum.
Regards,
Carsten
--
View this message in context: http://www.nabble.com/Content-of-incoming-message-is-of-type-StreamSource-instead-of-DOMSource-tf2589879s12049.html#a7221830
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Content of incoming message is of type StreamSource instead of
DOMSource
Posted by Carsten Schlipf <ca...@hp.com>.
Hi Guillaume,
thank you for the quick answer. So I am safe to assume that
SourceTransformer will always be capable to handle all possible Source
implementations that are used by ServiceMix, right?
Best regards,
Carsten
gnodet wrote:
>
> You should not rely on the Source type when writing a component.
> The source type may be changed by ServiceMix under certain conditions
> (for example if there is a dump of the exchange to log it, or if the
> exchange is serialized). You should use the SourceTransformer
> to change to a Source type that you can handle if you need to.
>
> On 11/7/06, Carsten Schlipf <ca...@hp.com> wrote:
>>
>> Hi all,
>>
>> I have used some snapshot releases of ServiceMix prior to the official
>> 3.0
>> release. Previously all standard components provided a DOMSource instance
>> of
>> the message, when I called getContent() on the incoming normalized
>> message.
>>
>> Starting with 3.0 this seems to have changed. Suddenly I get a
>> StreamSource
>> (or StringSource) representation of the message. Using getText() on this
>> StreamSource, I get a String representation of the XML document, which
>> must
>> be parsed into a DOM document, before I can continue processing the XML
>> content. This is even the case, if the sending component explicitely puts
>> a
>> DOMSource object in its outgoing message.
>>
>> I wonder what's the reason behind this change. To me it seems to be
>> somewhat
>> of an overhead to transform a DOMSource to a StreamSource just to parse
>> this
>> StreamSource into a DOM tree in the next component again.
>>
>> I haven't found anything regarding this using Google or searching this
>> forum.
>>
>> Regards,
>> Carsten
>> --
>> View this message in context:
>> http://www.nabble.com/Content-of-incoming-message-is-of-type-StreamSource-instead-of-DOMSource-tf2589879s12049.html#a7221830
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
>
>
> --
> Cheers,
> Guillaume Nodet
>
>
--
View this message in context: http://www.nabble.com/Content-of-incoming-message-is-of-type-StreamSource-instead-of-DOMSource-tf2589879s12049.html#a7234164
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Content of incoming message is of type StreamSource instead of DOMSource
Posted by Guillaume Nodet <gn...@gmail.com>.
You should not rely on the Source type when writing a component.
The source type may be changed by ServiceMix under certain conditions
(for example if there is a dump of the exchange to log it, or if the
exchange is serialized). You should use the SourceTransformer
to change to a Source type that you can handle if you need to.
On 11/7/06, Carsten Schlipf <ca...@hp.com> wrote:
>
> Hi all,
>
> I have used some snapshot releases of ServiceMix prior to the official 3.0
> release. Previously all standard components provided a DOMSource instance of
> the message, when I called getContent() on the incoming normalized message.
>
> Starting with 3.0 this seems to have changed. Suddenly I get a StreamSource
> (or StringSource) representation of the message. Using getText() on this
> StreamSource, I get a String representation of the XML document, which must
> be parsed into a DOM document, before I can continue processing the XML
> content. This is even the case, if the sending component explicitely puts a
> DOMSource object in its outgoing message.
>
> I wonder what's the reason behind this change. To me it seems to be somewhat
> of an overhead to transform a DOMSource to a StreamSource just to parse this
> StreamSource into a DOM tree in the next component again.
>
> I haven't found anything regarding this using Google or searching this
> forum.
>
> Regards,
> Carsten
> --
> View this message in context: http://www.nabble.com/Content-of-incoming-message-is-of-type-StreamSource-instead-of-DOMSource-tf2589879s12049.html#a7221830
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>
--
Cheers,
Guillaume Nodet