Skip to content

XMLWriter

Steve Cote edited this page Apr 23, 2017 · 1 revision

The XMLWriter is a very simple writer of DataFrames

Example

Configuration

"Writer" : {
	"class" : "XMLWriter",
	"target" : "[#$wrkdir#][#$FS#]users.xml",
	"header" : "",
	"rootElement" : "DataSet",
	"rootAttributes" : "version=\"1.0\" exporter=\"CoyoteDX\"",
	"rowElement" : "DataRow",
	"rowAttributes" : "seq=[#$currentRow#]",
	"fieldFormat" : "<Column name=\"{0}\" value=\"{4}\"/>"
}

Output

<?xml version="1.0">
<DataSet version="1.0" exporter="CoyoteDX">
<DataRow seq=1>
<Column name="Role" value="USER"/>
<Column name="FirstName" value="Glennie"/>
<Column name="LastName" value="Spikes"/>
<Column name="MiddleInitial" value="M"/>
<Column name="Gender" value="M"/>
<Column name="Username" value="gspikes"/>
<Column name="Password" value="sir88A9m!K"/>
<Column name="eMail" value="gspikes@yahoo.com"/>
<Column name="License" value="c7e8c798-10dd-44f4-8076-22108386ba54"/>
<Column name="Rating" value="1.7423525"/>
<Column name="Joined" value="2012/05/24"/>
<Column name="Visits" value="294"/>
</DataRow>
</DataSet>

Configuration Attributes

Name Description
class This is the fully qualified name to the class. If there is no namespace specified, then the default namespace of all the writers (coyote.dx.writer) is used.
target This attribute specifies the file URI the to which the writer will write.
header This attribute controls the header which is written to the output target. In the case of XML data this is most often the preamble, but not always.

This may be a more complete set of XML which is to be prepended to the root element containing the row data. For example, it is possible to specify a different root element and a few other elements before the data set is written.
footer This controls what is appended to the root element for the dataset.

The most common use for this attribute is to close out any enclosing elements specified in the header to ensure the resulting file is well-formed XML.
rootElement This is the name of the root element in which all the data rows are to be written.

By default, the root element of dataset is used.
rootAttributes This configuration attribute controls any XML attributes are to be specified in the rootElement.

This text is treated as a [[Template
rowElement Each field is enclosed in a row element. This attribute specifies the name of the element. The default is simply row.
rowAttributes This configuration attribute controls any XML attributes are to be specified in the rowElement.

This text is treated as a [[Template
fieldFormat This controls the format of the field within the row.

This uses the Java MessageFormat syntax for formatting the field.

The argument to the format string are {0}=Field Name, {1}=Field Type(short), {2}=Field Type Name, {3}=Object Value, {4}=String Value.

The default format will be <FieldName>StringValue</FieldName> which might be written as <{0}>{4}</{0}>.

Another popular format is <{0} type=\"{2}\">{4}</{0}> which outputs something like
<Quantity type="INT">144</Quantity>.

Home

  1. Concepts
  2. Features
  3. Transform Engine
  4. Quick Start
  5. Configuration
  6. Secrets Vault
  7. Readers
  8. Writers
    • List of Writers
    • Custom Writers
  9. Filters
    • Accept
    • Reject
    • Custom Filters
  10. Tasks
    • List of Tasks
    • Custom Tasks
  11. Validators
    • List of Validators
    • Custom Validators
  12. Listeners
    • List of Listeners
    • Custom Listeners
  13. Transforms
    • List of Transforms
    • Custom Transforms
  14. Mappers
  15. Context
  16. Databases
  17. Templates
  18. Logging
  19. Encryption
  20. Usage
  21. Expressions
  22. Examples
Clone this wiki locally