Subject:CSV to XML conversion help Author:Taron Barber Date:18 Mar 2008 05:36 PM
Hi,
I have just begun to work with XML and am in the process of trying to convert a csv file to XML but am having trouble. I need to get a CDATA section under one of the field elements. I need to get it setup to import as follows:
<inv>
<inventory>
<sku>
<quantity>
<url><![CDATA [import data from csv file.........
</inventory
</inv>
I can not get it to format in this way. I can only get it to import as follows:
Subject:CSV to XML conversion help Author:(Deleted User) Date:19 Mar 2008 06:19 AM
Hi,
ths CSV to XML converter doesn't allow to specify whether the data should be enclosed in CDATA sections, as in XML the CDATA section is just a syntactic feature that allows a user to freely type any text without the need of escaping the reserved characters (i.e. it's only useful if a human being is actually typing the data).
So an XML-compliant parser should find no difference between <[CDATA[http://www.xxxx.com/some/URL?key=value&key=value]]> and http://www.xxxx.com/some/URL?key=value&key=value (note that & turned into &). As a workaround, if your requirement to use CDATA sections cannot be avoided, you can post process the generated XML with an XSL indentity transformation that specifies the cdata-section-elements="url" attribute in the xsl:output instruction.