Creates a new instance of a StAXSource
by supplying an {@link XMLStreamReader}.
XMLStreamReader
must be a
non-null
reference.
XMLStreamReader
must be in
{@link XMLStreamConstants#START_DOCUMENT} or
{@link XMLStreamConstants#START_ELEMENT} state.
if (xmlStreamReader == null) {
throw new IllegalArgumentException(
"StAXSource(XMLStreamReader) with XMLStreamReader == null");
}
int eventType = xmlStreamReader.getEventType();
if (eventType != XMLStreamConstants.START_DOCUMENT
&& eventType != XMLStreamConstants.START_ELEMENT) {
throw new IllegalStateException(
"StAXSource(XMLStreamReader) with XMLStreamReader"
+ "not in XMLStreamConstants.START_DOCUMENT or "
+ "XMLStreamConstants.START_ELEMENT state");
}
this.xmlStreamReader = xmlStreamReader;
systemId = xmlStreamReader.getLocation().getSystemId();