3 Replies Latest reply on Jul 23, 2015 11:42 AM by bharadwaj

    CSV to XML Transformation

    tmcginnis

      I want to transform a CSV file to an XML file.  I am trying to use the Data Transformation component.  I am using the early access integration stack JBDS and Fuse 6.2.

      In the New Transformation window I select Other for the Types Transformed source type and XML for the Target Type.

      In the next window (Source Type (Other)) what do I use for the Source Class?

      It has an warning that says "No available data format definitions in the selected Camel configuration" what does that mean?

      How do I set this up?

        • 1. Re: CSV to XML Transformation
          bharadwaj

          CSV to XML transformation use camel-bindy component, It's like JAXB you need to provide pojo model with camel CSV annotations. Once you convert it to Object you can use JAXB of Xstream component to convert Object to xml format.

           

          For Example :

           

          <when>

                    <simple>${header.CamelFileName} regex '^.*(csv|csl)$'</simple>

                    <unmarshal>

                      <bindy packages="org.fusesource.camel.model" type="Csv" />

                    </unmarshal>

                     <marshal>

                      <xstream/>

                    </marshal>

           

                  </when>

          • 2. Re: CSV to XML Transformation
            tmcginnis

            I can't seem to retrieve the camel-bindy bundle from a maven repository.  I have tried http://repository.jboss.org/nexus/content/groups/ea but it keeps saying it can't find the jar.

            • 3. Re: CSV to XML Transformation
              bharadwaj

              <repositories>

                      <repository>

                          <id>fusesource.releases</id>

                          <name>FuseSource Release Repository</name>

                          <url>https://repository.jboss.org/nexus/content/repositories/fs-releases/</url>

                          <releases>

                              <enabled>true</enabled>

                          </releases>

                          <snapshots>

                              <enabled>false</enabled>

                          </snapshots>

                      </repository>

                      <repository>

                          <id>fusesource.ea</id>

                          <name>FuseSource Early Access Release Repository</name>

                          <url>https://repository.jboss.org/nexus/content/groups/ea/</url>

                          <snapshots>

                              <enabled>false</enabled>

                          </snapshots>

                          <releases>

                              <enabled>true</enabled>

                          </releases>

                      </repository>

                  </repositories>

               

               

              For your reference : Please follow the Example

               

              rider-auto-osgi/pom.xml at master · FuseByExample/rider-auto-osgi · GitHub