T
- The type of the handle used for each split
payloadpublic class XMLSplitter<T extends XMLWriteHandle> extends java.lang.Object implements Splitter<T>
Modifier and Type | Class and Description |
---|---|
static class |
XMLSplitter.BasicElementVisitor
The basic visitor only splits elements with
matching element namespace URI and local name.
|
static interface |
XMLSplitter.StartElementReader
The StartElementReader is used in visitor to
check if the current element is the one to split.
|
static interface |
XMLSplitter.UriMaker
UriMaker which generates URI for each split
file
|
static class |
XMLSplitter.Visitor<T extends XMLWriteHandle>
The Visitor class is used to check if the
current element is the target to split.
|
Constructor and Description |
---|
XMLSplitter(XMLSplitter.Visitor<T> visitor)
Construct an XMLSplitter which split the XML
file according to the visitor.
|
Modifier and Type | Method and Description |
---|---|
long |
getCount()
Returns the number of splits.
|
XMLSplitter.UriMaker |
getUriMaker()
Get the UriMaker of the splitter
|
XMLSplitter.Visitor<T> |
getVisitor()
Get the visitor used in XMLSplitter class.
|
static XMLSplitter<StringHandle> |
makeSplitter(java.lang.String nsUri,
java.lang.String localName)
Construct a simple XMLSplitter which split the
XML file according to element name.
|
void |
setUriMaker(XMLSplitter.UriMaker uriMaker)
Set the UriMaker to the splitter
|
void |
setVisitor(XMLSplitter.Visitor<T> visitor)
Set the visitor to select elements to split in
XMLSplitter.
|
java.util.stream.Stream<T> |
split(java.io.InputStream input)
Takes an input stream of an XML file and split
it into a steam of handles.
|
java.util.stream.Stream<T> |
split(javax.xml.stream.XMLStreamReader input)
Take an input of XMLStreamReader of the XML file
and split it into a stream of handles to write to database.
|
java.util.stream.Stream<DocumentWriteOperation> |
splitWriteOperations(java.io.InputStream input)
Takes an input stream of an XML file and split
it into a steam of DocumentWriteOperation.
|
java.util.stream.Stream<DocumentWriteOperation> |
splitWriteOperations(java.io.InputStream input,
java.lang.String splitFilename)
Takes an input stream of an XML file and input
file name, split it into a steam of DocumentWriteOperation.
|
java.util.stream.Stream<DocumentWriteOperation> |
splitWriteOperations(javax.xml.stream.XMLStreamReader input,
java.lang.String splitFilename)
Take an input of XMLStreamReader of the XML file
and split it into a stream of DocumentWriteOperations to write to
database.
|
public XMLSplitter(XMLSplitter.Visitor<T> visitor)
visitor
- determines which elements to splitpublic static XMLSplitter<StringHandle> makeSplitter(java.lang.String nsUri, java.lang.String localName)
nsUri
- The namespace URI of the elementlocalName
- the local name of the elementpublic XMLSplitter.Visitor<T> getVisitor()
public void setVisitor(XMLSplitter.Visitor<T> visitor)
visitor
- the visitor used in XMLSplitter
classpublic java.util.stream.Stream<T> split(java.io.InputStream input) throws java.io.IOException, javax.xml.stream.XMLStreamException
split
in interface Splitter<T extends XMLWriteHandle>
input
- is the incoming input stream of an XML
filejava.io.IOException
- if the input cannot be
splitjavax.xml.stream.XMLStreamException
- if there is
an error processing the underlying XML sourcepublic java.util.stream.Stream<DocumentWriteOperation> splitWriteOperations(java.io.InputStream input) throws java.lang.Exception
splitWriteOperations
in
interface Splitter<T extends XMLWriteHandle>
input
- is the incoming input stream.java.lang.Exception
- if the input cannot be
splitpublic java.util.stream.Stream<DocumentWriteOperation> splitWriteOperations(java.io.InputStream input, java.lang.String splitFilename) throws java.lang.Exception
splitWriteOperations
in
interface Splitter<T extends XMLWriteHandle>
input
- is the incoming input stream.splitFilename
- is the name of input file,
including name and extension. It is used to generate URLs for split
files.The splitFilename could either be provided here or in
user-defined UriMaker.java.lang.Exception
- if the input cannot be
splitpublic long getCount()
getCount
in interface Splitter<T extends XMLWriteHandle>
public java.util.stream.Stream<T> split(javax.xml.stream.XMLStreamReader input) throws java.io.IOException
input
- an XMLStreamReader of the XML filejava.io.IOException
- if the input cannot be
splitpublic java.util.stream.Stream<DocumentWriteOperation> splitWriteOperations(javax.xml.stream.XMLStreamReader input, java.lang.String splitFilename)
input
- an XMLStreamReader of the XML filesplitFilename
- is the name of the input file,
including name and extension. It is used to generate URLs for split
files.The splitFilename could either be provided here or in
user-defined UriMaker.public XMLSplitter.UriMaker getUriMaker()
public void setUriMaker(XMLSplitter.UriMaker uriMaker)
uriMaker
- the uriMaker to generate URI of each
split file.Copyright © 2024 MarkLogic Corporation. All Rights Reserved.