This article is available as a PDF here.
Sometimes, it's helpful to store raw XML in the database. A few scenarios come to mind. One is using a column of raw XML alongside other fields for auditing or system troubleshooting purposes. Another is caching. An XML document may be built up within a database for fast retrieval later.
Talend Open Studio's tWriteXMLField works with this structure by mapping the fields of an input source to a field in the output source. Most likely, the output source will be an RDBMS, but could also be a web service.
This example turns a record from a line in a CSV file into an XML document stored in a MySQL column. As the XML is added, an AUTO_INCREMENT id is applied by MySQL.
The source schema is CONTACT_CSV(firstName, city, state). The target schema is CONTACT_XML(contact_xml_id, contact_xml) where contact_xml is a Clob (TEXT) containing an XML document.
|Job Using tWriteXMLField|
|Talend Ignoring ID Column on Insert and Update|
|TEXT Column in MySQL Table|