Storing XML Source as String in a Database & Retreiving Stored XML String to an XML File Target

Scenario: User may want to store an XML File Source as a string in the database, or may want to convert XML string stored in the database to an XML File Target.

Solution: Following are the steps to store XML Source as a string in the database.

1. Create an XSL template with name "copyXMLBody" . Copy the below contents in the template 

  <!-- template code starts-->
          <xsl:text disable-output-escaping="yes">&lt;</xsl:text>
          <xsl:value-of select="&apos;![CDATA[&apos;"/>
          <xsl:text disable-output-escaping="yes">&lt;</xsl:text>
          <xsl:value-of select="&apos;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&apos;"/>
          <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
          <xsl:copy-of select="."/>
    <!-- template code ends-->
          <xsl:value-of select="&apos;]]&apos;"/>
          <xsl:text disable-output-escaping="yes">&gt;</xsl:text>

2. Now on the target node of Database schema in the mapper, call the template in the textual rule.



Follow the given steps to covert a stored XML string in the database to an XML File Target:

  1. Create database schema with query "SELECT <XML Column Name> FROM<TableName>".
  2. In Data Mapping, select DB as a source and context schema as the File Target (variable varXML).
  3. In PF placement of activities will be as below
DB Source --- Data Mapper (with generate stream as false) --- Context Source (Read varXML) --- File Target
Have more questions? Submit a request


Article is closed for comments.