Formatting Results as CSV
The format for mashup results is typically XML. You can have mashups format the result as CSV (comma-separated values), using the FormatAsCSV macro. This macro is installed with the EMML Reference Runtime Engine and is available for use in any mashup script.
<macro:FormatAsCSV>
Use the following attributes to define the input parameters for this macro and receive the results:
| Attribute | Required | Description |
|---|---|---|
xmldoc |
yes |
The name of the document-type variable containing the results to format as a CSV string. For this macro to work correctly, the structure of this input document:
|
outputvariable |
yes |
The name of the variable to receive the results of this macro. This variable is a string datatype to receive the CSV-formatted results. Although this is not required, it is quite typical for this variable to be the output parameter for the mashup that is calling this macro. |
<macro:FormatAsCSV> Example
<mashup name="formatCSVBasic"
xmlns="http://www.openemml.org/2009-04-15/EMMLSchema"
xsi:schemaLocation="http://www.openemml.org/2009-04-15/EMMLSchema
../schema/EMMLSpec.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:macro="http://www.openemml.org/2009-04-15/EMMLMacro">
...
<variables>
<variable name="cvsString" type="string"/>
<variable name="sampleXML" type="document">
<sample>
<item>
<breed>St. Bernard</breed>
<category>working dog</category>
</item>
<item>
<breed>Poodle, Standard</breed>
<category>working dog</category>
</item>
...
</sample>
</variable>
</variable>
<macro:FormatAsCSV xmldoc="$sampleXML" outputvariable="$csvString"/>
...
Enterprise Mashup Markup Language (EMML) Documentation is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.
