Class XmlStreamSplitterConfig
- All Implemented Interfaces:
Labelable
Splits XML document on a specific element.
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.
Element matching
To identify the element to split on, you give the full path to it from the document root, where each element is separated by a forward slash. Let's take this XML as an example:
<animals>
<species name="mouse">
<animal>
<name>Itchy</name>
<race>cartoon</race>
</animal>
</species>
<species name="cat">
<animal>
<name>Scratchy</name>
<race>cartoon</race>
</animal>
</species>
</animals>
To split on <animal>, you would use this path:
/animals/species/animal
Should be used as a pre-parse handler.
Content-types
By default, this filter is restricted to (applies only to) documents matching
the restrictions returned by
CommonRestrictions.xmlContentTypes(String).
You can specify your own restrictions to further narrow, or loosen what
documents this splitter applies to.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanThe matcher of content types to apply splitting on.Matcher of one or more fields to use as the source of content to split into new documents, instead of the original document content.getPath()inthashCode()setContentTypeMatcher(TextMatcher contentTypeMatcher) The matcher of content types to apply splitting on.setFieldMatcher(TextMatcher fieldMatcher) toString()Methods inherited from class com.norconex.importer.handler.splitter.BaseDocumentSplitterConfig
isDiscardOriginal, setDiscardOriginalMethods inherited from class com.norconex.importer.handler.BaseLabelableConfig
getLabel, setLabel
-
Constructor Details
-
XmlStreamSplitterConfig
public XmlStreamSplitterConfig()
-
-
Method Details
-
setContentTypeMatcher
The matcher of content types to apply splitting on. No attempt to split documents of any other content types will be made. Default isCommonMatchers.DOM_CONTENT_TYPES.- Parameters:
contentTypeMatcher- content type matcher- Returns:
- this
-
setFieldMatcher
-
getPath
-
getContentTypeMatcher
The matcher of content types to apply splitting on. No attempt to split documents of any other content types will be made. Default isCommonMatchers.DOM_CONTENT_TYPES.- Returns:
- content type matcher
-
getFieldMatcher
Matcher of one or more fields to use as the source of content to split into new documents, instead of the original document content.- Returns:
- field matcher
-
setPath
- Returns:
this.
-
equals
- Overrides:
equalsin classBaseDocumentSplitterConfig
-
canEqual
- Overrides:
canEqualin classBaseDocumentSplitterConfig
-
hashCode
public int hashCode()- Overrides:
hashCodein classBaseDocumentSplitterConfig
-
toString
- Overrides:
toStringin classBaseDocumentSplitterConfig
-