XmlRootAdderPreparser

Group

Preparsers

Class Name

com.ebd.hub.datawizard.parser.stream.XmlRootAdderPreparser

Function

This preparser is able to create an 'artificial' root element that encloses the content of the received XML file.

Configuration File

sample_XmlRootAdderPreparser.properties

Description


This preparser is able to create an 'artificial' root element that encloses the content of the received XML file. This can be used to transform a received XML file with several root elements into a 'valid' XML file. To do so, it might be necessary to remove the XML header beforehand. The default name for the new root element is RootElement. The resulting XML file will not have an XML header. The preparser uses the encoding in the profile settings, not the one given in the XML header.

Another operation mode of the preparser allows creating a header in front of, or a footer after, the content of the received XML file. The text is inserted as normal text and not in the form of XML tags, although the text could contain XML tags. If a header, a footer, or both are defined, the preparser will not create a root element, but instead insert the header text at the beginning of the XML file, followed by New Line, and the footer text at the end of the XML file.

Parameter Description


Parameter

Description

root.name

(optional) Name of the root element to insert. Default: RootElement

Important note: This parameter is ignored if one of the parameters insert.headline or append.footline is used.

remove.xmlheader

(optional) If true, the XML header is removed. Default: false

insert.headline

(optional) Text line that is inserted in front of the file content. Default: <Empty line>

append.footline

(optional) Text line that is inserted after the file content. Default: <Empty line>

Example



sample_XmlRootAdderPreparser.properties
#
# Name of the new root element. Default: RootElement
root.name=TestRoot
# Remove XML header? true or false. Default: false
remove.xmlheader=true
#Textline, to be set at the beginning of the received file.
#insert.headline=
#Textline, to be set at the end of the received file. Default: space
#append.footline=