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"><</xsl:text>
<xsl:value-of select="'![CDATA['"/>
<xsl:text disable-output-escaping="yes"><</xsl:text>
<xsl:value-of select="'?xml version="1.0" encoding="UTF-8"?'"/>
<xsl:text disable-output-escaping="yes">></xsl:text>
<xsl:copy-of select="."/>
<!-- template code ends-->
<xsl:value-of select="']]'"/>
<xsl:text disable-output-escaping="yes">></xsl:text>
2. Now on the target node of Database schema in the mapper, call the template in the textual rule.
CALL TEMPLATE NAME="copyXMLBody" ~0="."
Follow the given steps to covert a stored XML string in the database to an XML File Target:
- Create database schema with query "SELECT <XML Column Name> FROM<TableName>".
- In Data Mapping, select DB as a source and context schema as the File Target (variable varXML).
- In PF placement of activities will be as below
DB Source --- Data Mapper (with generate stream as false) --- Context Source (Read varXML) --- File Target
Comments
0 comments
Article is closed for comments.