1 Reply Latest reply on Dec 15, 2008 3:29 AM by ashok_1979

    Not able to transform java object to desired xml

      Hi All,
      i want to transform java object into xml file.
      to achieve this what i am doing is
      1. First i am creating SAX stream from java object using below configuration

      <resource-config selector="global-parameters">
      SAX
      </resource-config>

      This is creating one XML stream out of the object in below format

      <com.service.railbill.valueObject.ShipmentDetailsVO>


      421
      true
      0
      true
      ...
      ...
      <com.service.railbill.valueObject.ShipmentDetailsVO>

      2. Now i want to transform this default XML into desired XML format by using this configuration

      <resource-config selector="com.service.railbill.valueObject.ShipmentDetailsVO">

      <![CDATA[

      <xsl:for-each select="shipmentData">


      </xsl:for-each>

      <xsl:for-each select="lineItems">
      <xsl:for-each select="com.service.railbill.valueObject.ShipmentLineVO">


      </xsl:for-each>
      </xsl:for-each>


      ]]>

      true
      </resource-config>

      But second transformation is not getting applied, i am getting following lines in logger

      12:41:02,218 INFO [STDOUT] Value of action: TransformShipmentData
      12:41:02,218 INFO [STDOUT] Old Value of resource config: E://smooks-config.xml
      12:41:02,218 INFO [STDOUT] New Value of resource config: E://smooks-config.xml
      12:41:02,218 INFO [STDOUT] Exit from updateConfigTree(ConfigTree configTree, St
      ring resourceConfPath) of TransformDataAction class:
      12:41:02,218 INFO [STDOUT] Value of resource config in process method: E://smoo
      ks-config.xml
      12:41:02,218 INFO [ClassUtil] Loaded 4 classes from 2 URLs through class list f
      ile META-INF/content-handlers.inf. Process took 0ms. Turn on debug logging for
      more info.
      12:41:02,359 INFO [ContentDeliveryConfigBuilder] All configured XML Element Con
      tent Handler resource configurations can be applied using the SAX or DOM Stream
      Filter. Defaulting to DOM Filter. Set 'global-parameters:stream.filter.type'.
      Turn on debug logging for more info.

      Please help me to reach the bottom line of problem.

      Below is the complete smooks transformation file i am using

      <?xml version="1.0"?>
      <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd" default-target-profile="from:source-java">

      <resource-config selector="global-parameters">
      SAX
      </resource-config>

      <resource-config selector="com.service.railbill.valueObject.ShipmentDetailsVO">

      <![CDATA[

      <xsl:for-each select="shipmentData">


      </xsl:for-each>

      <xsl:for-each select="lineItems">
      <xsl:for-each select="com.service.railbill.valueObject.ShipmentLineVO">


      </xsl:for-each>
      </xsl:for-each>


      ]]>

      true
      </resource-config>

      </smooks-resource-list>

        • 1. Re: Not able to transform java object to desired xml

          Sorry! last post was having some formatting error.
          Please find below the smooks transformation file

          <?xml version="1.0"?>
          <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.0.xsd" default-target-profile="from:source-java">
          
           <resource-config selector="global-parameters">
           <param name="stream.filter.type">SAX</param>
           </resource-config>
          
           <resource-config selector="com.service.railbill.valueObject.ShipmentDetailsVO">
           <resource type="xsl">
           <![CDATA[
           <ShipmentInfo>
           <xsl:for-each select="shipmentData">
           <ShipmentHeader shipmentID="{accountManagerId}"
           transMode="{accountManagerIdUpdated}">
           </ShipmentHeader>
           </xsl:for-each>
           <LineItems>
           <xsl:for-each select="lineItems">
           <xsl:for-each select="com.service.railbill.valueObject.ShipmentLineVO">
           <LineItem actualNmfcClass="{actualNmfcClass}"
           createdBy="{createdBy}" deletedBy="{deletedBy}">
           </LineItem>
           </xsl:for-each>
           </xsl:for-each>
           </LineItems>
           </ShipmentInfo>
           ]]>
           </resource>
           <param name="is-xslt-templatelet">true</param>
           </resource-config>
          
          </smooks-resource-list>
          


          and below is the part of xml file which is getting generated

          <com.service.railbill.valueObject.ShipmentDetailsVO>
           <shipmentData>
           <serverSideValidation />
           <accountManagerId>421</accountManagerId>
           <accountManagerIdUpdated>true</accountManagerIdUpdated>
           <allowShare>0</allowShare>
           <allowShareUpdated>true</allowShareUpdated>
           <arTotals>1450.0</arTotals>
           ...
           ...
           </shipmentData>
           <lineItems>
           <com.service.railbill.valueObject.ShipmentLineVO>
           <serverSideValidation />
           <actualNmfcClass>0.0</actualNmfcClass>
           <actualNmfcClassUpdated>true</actualNmfcClassUpdated>
           ...
           ...
           </lineItems>
          <com.service.railbill.valueObject.ShipmentDetailsVO>