XmlStreamSplitter
Splits XML document on a specific element.
Notes
This class is suited for large XML documents. It will read the XML as a stream and split as it is read, preserving memory during parsing. For this reason, element matching is not as flexible as DOM-based XML parsers, such as DOMSplitter, but is more efficient on large documents.
Examples
The following example will create one document per animals, based on the sample XML given above.
- YAML
- JSON
- XML
handler:
class: XmlStreamSplitter
path: /animals/species/animal
{
"handler": {
"class": "XmlStreamSplitter",
"path": "/animals/species/animal"
}
}
<handler>
<class>XmlStreamSplitter</class>
<path>/animals/species/animal</path>
</handler>
Usage
Full configuration skeleton, with every option and its default
- YAML
- JSON
- XML
class: XmlStreamSplitter
contentTypeMatcher:
ignoreCase: false
ignoreDiacritic: false
matchEmpty: false
method: BASIC
negateMatches: false
partial: false
pattern: string
replaceAll: false
trim: false
discardOriginal: false
fieldMatcher:
ignoreCase: false
ignoreDiacritic: false
matchEmpty: false
method: BASIC
negateMatches: false
partial: false
pattern: string
replaceAll: false
trim: false
label: string
path: string
{
"class": "XmlStreamSplitter",
"contentTypeMatcher": {
"ignoreCase": false,
"ignoreDiacritic": false,
"matchEmpty": false,
"method": "BASIC",
"negateMatches": false,
"partial": false,
"pattern": "string",
"replaceAll": false,
"trim": false
},
"discardOriginal": false,
"fieldMatcher": {
"ignoreCase": false,
"ignoreDiacritic": false,
"matchEmpty": false,
"method": "BASIC",
"negateMatches": false,
"partial": false,
"pattern": "string",
"replaceAll": false,
"trim": false
},
"label": "string",
"path": "string"
}
<handler>
<class>XmlStreamSplitter</class>
<contentTypeMatcher>
<ignoreCase>false</ignoreCase>
<ignoreDiacritic>false</ignoreDiacritic>
<matchEmpty>false</matchEmpty>
<method>BASIC</method>
<negateMatches>false</negateMatches>
<partial>false</partial>
<pattern>string</pattern>
<replaceAll>false</replaceAll>
<trim>false</trim>
</contentTypeMatcher>
<discardOriginal>false</discardOriginal>
<fieldMatcher>
<ignoreCase>false</ignoreCase>
<ignoreDiacritic>false</ignoreDiacritic>
<matchEmpty>false</matchEmpty>
<method>BASIC</method>
<negateMatches>false</negateMatches>
<partial>false</partial>
<pattern>string</pattern>
<replaceAll>false</replaceAll>
<trim>false</trim>
</fieldMatcher>
<label>string</label>
<path>string</path>
</handler>
Properties
| Property | Type | Required | Default |
|---|---|---|---|
contentTypeMatcher | TextMatcher | No | TextMatcher |
discardOriginal | boolean | No | false |
fieldMatcher | TextMatcher | No | TextMatcher |
label | string | No | - |
path | string | No | - |
Property Details
contentTypeMatcher
The content type of the XML document.
discardOriginal
Discard the original document after the split is performed.
fieldMatcher
Matches document fields based on specified patterns and methods
label
An optional, user-supplied label for this step in the importer pipeline. It has no effect on processing — it exists purely to help identify this step, for example in large configurations or in the visual configurator.
path
The path to the element to split on.