Package com.boomi.connector.util.xml
Class XMLSplitter
- java.lang.Object
-
- com.boomi.connector.util.xml.XMLEventUtilBase
-
- com.boomi.connector.util.xml.XMLSplitter
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterable<Payload>
public abstract class XMLSplitter extends XMLEventUtilBase implements Iterable<Payload>
Utility for efficiently splitting/stripping an xml document into one or more payloads. Provides a variety of customization points for altering the content of the output data (seeXMLEventUtilBase.startObject(javax.xml.stream.events.XMLEvent)
,XMLEventUtilBase.addObjectEvent(javax.xml.stream.events.XMLEvent)
,XMLEventUtilBase.finishObject()
, andfindNextObjectStart(boolean)
). This class must be closed in order to free underlying resources.
-
-
Field Summary
-
Fields inherited from class com.boomi.connector.util.xml.XMLEventUtilBase
logger, NAMESPACE_AWARE_PROP, REPAIR_NAMESPACE_PROP
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
XMLSplitter(XMLEventReader reader)
protected
XMLSplitter(XMLEventReader reader, PayloadMetadata metadata)
protected
XMLSplitter(XMLEventReader reader, XMLOutputFactory outFactory)
protected
XMLSplitter(XMLEventReader reader, XMLOutputFactory outFactory, PayloadMetadata metadata)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
closeImpl()
Does the actual close work for this instance, will only be called once.protected abstract XMLEvent
findNextObjectStart(boolean isFirst)
Finds the first event for the start of the next output object from the input reader.protected PayloadMetadata
getMetadata()
protected void
initialize()
Iterator<Payload>
iterator()
XMLEvent
peekNextObjectStart()
Returns the start XMLEvent for the next object.-
Methods inherited from class com.boomi.connector.util.xml.XMLEventUtilBase
addObjectEvent, close, closeQuietly, closeReader, closeWriter, createEventFactory, createInputFactory, createInputFactory, createOutputFactory, createOutputFactory, findNextElementStart, finishObject, getEventFactory, getInputFactory, getOutputFactory, getReader, getWriter, openReader, openWriter, setReader, setWriter, startObject
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
XMLSplitter
protected XMLSplitter(XMLEventReader reader)
-
XMLSplitter
protected XMLSplitter(XMLEventReader reader, XMLOutputFactory outFactory)
-
XMLSplitter
protected XMLSplitter(XMLEventReader reader, PayloadMetadata metadata)
-
XMLSplitter
protected XMLSplitter(XMLEventReader reader, XMLOutputFactory outFactory, PayloadMetadata metadata)
-
-
Method Detail
-
initialize
protected void initialize() throws XMLStreamException
- Throws:
XMLStreamException
-
getMetadata
protected PayloadMetadata getMetadata()
-
peekNextObjectStart
public XMLEvent peekNextObjectStart()
Returns the start XMLEvent for the next object.- Throws:
NoSuchElementException
- if there is no next object
-
closeImpl
protected void closeImpl()
Description copied from class:XMLEventUtilBase
Does the actual close work for this instance, will only be called once.- Specified by:
closeImpl
in classXMLEventUtilBase
-
findNextObjectStart
protected abstract XMLEvent findNextObjectStart(boolean isFirst) throws XMLStreamException
Finds the first event for the start of the next output object from the input reader.- Parameters:
isFirst
- whether this is the first object in the stream or a subsequent object- Returns:
- the first event for the next object, or
null
if there are no more objects in the reader - Throws:
XMLStreamException
-
-