XML Document Writer

From PresenceWiki
Revision as of 11:14, 19 August 2015 by Rob (Talk | contribs)

(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

XML Document Writer

The XML Document Writer (as opposed to the Basic XML Writer) creates a structured XML document based on:

  • A supplied XSD
  • Incoming Data Table

XML Document Writer is an Anonymous Task Element, meaning that it is not re-usable - copies can be made, but changes to one instance will not affect other instances.

To create an XML Document Writer, simply drag the Node from the Data Formatters list into your Task. You will then be presented with the XML Document Writer dialog:

Schema Location

Xml doc writer 1.png

XML Schema Location

This is the location of the XSD schema that should be used to generate the document. It can be on your local network, on the internet or on an FTP server. Once selected you can view the raw XSD document in the window, as above. To change the schema once selected, click "Edit" - please note that this will impact selections made in subsequent panels.

Document Format

Xml doc writer 2.png

As you can see, this panel is split into two distinct parts, with a tree representation of the schema on the left and the input panel on the right.

The basic principle of this interface is that you can select an element or attribute from the tree on the left, then input the value in the text pane on the right. This can be a literal String (e.g. "Bob Smith") or a variable reference (eg ${variable}) or more commonly a Data Table column reference (e.g. :var{SURNAME} ).

Enclose text in CDATA Section

This is recommended if you expect a large chunk of text, or text containing "<" or ">" characters. Everything inside a CDATA Section is ignored by XML parsers.

Treat this text as a comment

If this is selected any text will appear as a comment in the XML document, i.e. it will be enclosed by a comment tag as follows:

<!-- this is a comment! -->

Element Repetition

By default Elements will not be repeated, however you can control how an Element is repeated by selecting the Element you wish to repeat and choosing the "Element Repetition" tab and checking "Repeat occurrences of this Element":

Xml doc writer 3.png

You will then see a list of available columns (see above), and you should select the columns that this element should repeat for. For instance, above, we have selected "TRAP_NUMBER". This will cause the enclosing <dog> element to be repeated for each value of TRAP_NUMBER, which is the behaviour we want.

Inclusion Rules

This panel allows you to set Rules which control which values are included and which are not. If the value currently being considered does not match the rules specified then the Element will not be included in the final XML document.

To add a rule, drag the column or variable name from the tree view on the left into the conditions panel and enter the rules you would like to include. As with similar functionality, rules can be stacked into AND / OR groups to fine-tune your requirements.


Xml doc writer 4.png

This panel allows you to confirm the location that the final XML document should be written to (a variable or a file location), in addition to previewing the results.

Where variables or column references have been used you will be prompted to enter sample values in order to generate the preview. This is optional - you can click cancel.

Click Okay to complete the Node and include it in your Task.

< Back to Task Elements

See Also

Task Elements > Data Format Nodes > XML Document Writer

CSV Writer | HTML Table Writer | Basic XML Writer | XML Document Writer
XSLT Processor | Padded Text Writer | Custom Data Formatter Standard Option | Custom Data Formatter PDF Option
Custom Nodes

Task Elements | Resources