0

I'm using spring integration to get messages off of an outgoing channel. Each message is in the following format:

<message>
  <properties>
    <property>
      <key>a</key>
      <value>b</value>
    </property>
    <property>
      <key>c</key>
      <value>d</value>
    </property>
  </properties>
</message>

For each message I want to parse value b for key a and write to disk. How can I do this in spring integration?

3

2 Answers 2

1

There is XpathSplitter to perform some xpath against incoming document and produce sub-documents for matched parts.

There is just regular XPathTransformer to extract the part of incoming document according provided xpath.

To store to disk you should use FileWritingMessageHandler.

It's really isn't clear why that Reference Manual isn't enough to find an answer...

Sign up to request clarification or add additional context in comments.

1 Comment

I ended up using an XPathTransformer with an XPathExpression.
0

You can use UnmarshallingTransformer from Spring Integration, refer this official documentation.

An UnmarshallingTransformer allows an XML Source to be unmarshalled using implementations of the Spring OXM Unmarshaller. Spring’s Object/XML Mapping support provides several implementations supporting marshalling and unmarshalling using JAXB, Castor and JiBX amongst others. The unmarshaller requires an instance of Source. If the message payload is not an instance of Source, conversion will be attempted. Currently String, File and org.w3c.dom.Document payloads are supported. Custom conversion to a Source is also supported by injecting an implementation of a SourceFactory.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.