Generating an XML file

Running into a problem when trying to convert a TXT file to XML. I have the workflow setup so that the TXT input file is ran through a data mapper. The input file has already been split so it is a single record that is going through the data mapper. The data mapper is working correctly as it is pulling several metadata fields based on the column they appear within the TXT file. All of the fields are labeled and appear correctly when viewing within the Data Model.

Within the workflow, I have used the Execute Data Mapping with the Output Type of “Output results in XML data file”. When I “Send To Folder” with the filename %{Filename}.txt it creates a TXT file that resembles a good XML file:
<?xml version=“1.0” ?>
<datamining><record>
<_vger_record_id>708364</_vger_record_id>
<SO#>00032-0000000053</SO#>
</record>
</datamining>

That’s good, but once I change the filename to %{Filename}.xml it is only creating a file with just the _vger_record_id # without any tags:
708460

Is there a setting that needs to be changed that will allow a proper XML file to be created? I have even tried to Change Emulation>XML prior to sending it to the destination folder. Has anyone ran into an issue like this and has an idea how to fix it?

Let me know if further elaboration on any of these aspects is required.

I have a feeling the issue is caused by whatever application you are using to open the resulting file after it’s been sent to the specified folder. The XML file generated by the DataMapping task is apparently incorrect because a # character is not allowed as part of an XML element name.

When you double-click on that XML file, your XML Viewer application tries to interpret the XML code and stops after the first field (e.g. 708364) because the second one is invalid. If you were to open that same XML file with Notepad (which is probably what you were viewing your TXT file with), then the entire XML file is displayed because Notepad does not attempt to validate the contents of the file.

To fix the issue, open your data mapping configuration and change the SO# field name to SO (or SO_Number, or SOnum, or something similar). Send the DM config to Workflow and try your process again: it should now work.