Class StAXSource
- All Implemented Interfaces:
Source
Acts as a holder for an XML Source in the
form of a StAX reader,i.e.
XMLStreamReader or XMLEventReader.
StAXSource can be used in all cases that accept
a Source, e.g. Transformer,
Validator which accept
Source as input.
StAXSources are consumed during processing
and are not reusable.
- Since:
- 1.6
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringIfTransformerFactory.getFeature(String name)returns true when passed this value as an argument, the Transformer supports Source input of this type. -
Constructor Summary
ConstructorsConstructorDescriptionStAXSource(XMLEventReader xmlEventReader) Creates a new instance of aStAXSourceby supplying anXMLEventReader.StAXSource(XMLStreamReader xmlStreamReader) Creates a new instance of aStAXSourceby supplying anXMLStreamReader. -
Method Summary
Modifier and TypeMethodDescriptionGet the system identifier used by thisStAXSource.Get theXMLEventReaderused by thisStAXSource.Get theXMLStreamReaderused by thisStAXSource.booleanisEmpty()Indicates whether theStAXSourceobject is empty.voidsetSystemId(String systemId) In the context of aStAXSource, it is not appropriate to explicitly set the system identifier.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.toString()Answers a string containing a concise, human-readable description of the receiver.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Field Details
-
FEATURE
IfTransformerFactory.getFeature(String name)returns true when passed this value as an argument, the Transformer supports Source input of this type.- See Also:
-
-
Constructor Details
-
StAXSource
Creates a new instance of a
StAXSourceby supplying anXMLEventReader.XMLEventReadermust be a non-nullreference.XMLEventReadermust be inXMLStreamConstants.START_DOCUMENTorXMLStreamConstants.START_ELEMENTstate.- Parameters:
xmlEventReader-XMLEventReaderused to create thisStAXSource.- Throws:
XMLStreamException- IfxmlEventReaderaccess throws anException.IllegalArgumentException- IfxmlEventReader==null.IllegalStateException- IfxmlEventReaderis not inXMLStreamConstants.START_DOCUMENTorXMLStreamConstants.START_ELEMENTstate.
-
StAXSource
Creates a new instance of a
StAXSourceby supplying anXMLStreamReader.XMLStreamReadermust be a non-nullreference.XMLStreamReadermust be inXMLStreamConstants.START_DOCUMENTorXMLStreamConstants.START_ELEMENTstate.- Parameters:
xmlStreamReader-XMLStreamReaderused to create thisStAXSource.- Throws:
IllegalArgumentException- IfxmlStreamReader==null.IllegalStateException- IfxmlStreamReaderis not inXMLStreamConstants.START_DOCUMENTorXMLStreamConstants.START_ELEMENTstate.
-
-
Method Details
-
getXMLEventReader
Get the
XMLEventReaderused by thisStAXSource.XMLEventReaderwill benull. if thisStAXSourcewas created with aXMLStreamReader.- Returns:
XMLEventReaderused by thisStAXSource.
-
getXMLStreamReader
Get the
XMLStreamReaderused by thisStAXSource.XMLStreamReaderwill benullif thisStAXSourcewas created with aXMLEventReader.- Returns:
XMLStreamReaderused by thisStAXSource.
-
setSystemId
In the context of a
StAXSource, it is not appropriate to explicitly set the system identifier. TheXMLStreamReaderorXMLEventReaderused to construct thisStAXSourcedetermines the system identifier of the XML source.An
UnsupportedOperationExceptionis always thrown by this method.- Specified by:
setSystemIdin interfaceSource- Parameters:
systemId- Ignored.- Throws:
UnsupportedOperationException- Is always thrown by this method.
-
getSystemId
Get the system identifier used by this
StAXSource.The
XMLStreamReaderorXMLEventReaderused to construct thisStAXSourceis queried to determine the system identifier of the XML source.The system identifier may be
nullor an empty""String.- Specified by:
getSystemIdin interfaceSource- Returns:
- System identifier used by this
StAXSource.
-
isEmpty
-