3 Replies Latest reply on Apr 17, 2009 6:19 AM by Tom Fennelly

    Smooks Splitting Message

    Patrick Pussar Newbie

      I trying to split a message into pieces and write those pieces to a file.

      But in difference to the available examples I want to write all e.g. order-items to a file order-item.txt and dont want to create a file/order-item.

      I tryed a configuration like that (my order-item is my product, which is a child element of Company):

      <!-- Hotel - Create/open a file output stream. -->
       <file:outputStream openOnElement="Company" resourceName="hotelSplitStream">
       <file:highWaterMark mark="1" />
       <!-- Hotel -->
       <ftl:freemarker applyOnElement="Product">
       <ftl:outputTo outputStreamResource="hotelSplitStream" />

      But that produces me this error message:
      Caused by: org.milyn.SmooksException: OutputResource 'hotelSplitStream' not bound to context. Configure an 'org.milyn.io.AbstractOutputStreamResource' implementation, or change resource ordering.

      Apperently, the stream is only visible on the same element...?
      Is my use case feasible like this? Or do I have to find another way?

        • 1. Re: Smooks Splitting Message
          Tom Fennelly Master

          What does the input message look like?

          • 2. Re: Smooks Splitting Message
            Patrick Pussar Newbie

            The XML - input message looks basicly like that:


            Whereas the plural in the tag name indicates a 1-n relation, meaning under e.g. Agencies are multiple Agency elements.

            What I plan is to create csv-files out of this xml-message. Each csv-file should hold a specific entity (like product or agency etc.)

            • 3. Re: Smooks Splitting Message
              Tom Fennelly Master

              From what I see there... it looks as though it should work... the file:outputStream is scoped around the Company fragment (openOnElement="Company") and the templating is applied on the Product fragment (applyOnElement="Product"), which is within the "Company" fragment.

              If you could send an executable example based on either the ESB quickstart or Smooks example formats, then I could have a quick look.