class StaxSource
extends javax.xml.transform.sax.SAXSource
Source
tagging interface for StAX readers. Can be constructed with
an XMLEventReader
or an XMLStreamReader
.
This class is necessary because there is no implementation of Source
for StAX Readers
in JAXP 1.3. There is a StAXSource
in JAXP 1.4 (JDK 1.6), but this class is kept around
for backwards compatibility reasons.
Even though StaxSource
extends from SAXSource
, calling the methods of
SAXSource
is not supported. In general, the only supported operation
on this class is to use the XMLReader
obtained via SAXSource.getXMLReader()
to parse the
input source obtained via SAXSource.getInputSource()
. Calling setXMLReader(XMLReader)
or setInputSource(InputSource)
will result in UnsupportedOperationException
s.
XMLEventReader
,
XMLStreamReader
,
Transformer
Modifier and Type | Field and Description |
---|---|
private javax.xml.stream.XMLEventReader |
eventReader |
private javax.xml.stream.XMLStreamReader |
streamReader |
Constructor and Description |
---|
StaxSource(javax.xml.stream.XMLEventReader eventReader)
Construct a new instance of the
StaxSource with the specified XMLEventReader . |
StaxSource(javax.xml.stream.XMLStreamReader streamReader)
Construct a new instance of the
StaxSource with the specified XMLStreamReader . |
Modifier and Type | Method and Description |
---|---|
(package private) javax.xml.stream.XMLEventReader |
getXMLEventReader()
Return the
XMLEventReader used by this StaxSource . |
(package private) javax.xml.stream.XMLStreamReader |
getXMLStreamReader()
Return the
XMLStreamReader used by this StaxSource . |
void |
setInputSource(org.xml.sax.InputSource inputSource)
Throws an
UnsupportedOperationException . |
void |
setXMLReader(org.xml.sax.XMLReader reader)
Throws an
UnsupportedOperationException . |
private javax.xml.stream.XMLEventReader eventReader
private javax.xml.stream.XMLStreamReader streamReader
StaxSource(javax.xml.stream.XMLStreamReader streamReader)
StaxSource
with the specified XMLStreamReader
.
The supplied stream reader must be in XMLStreamConstants.START_DOCUMENT
or
XMLStreamConstants.START_ELEMENT
state.streamReader
- the XMLStreamReader
to read fromjava.lang.IllegalStateException
- if the reader is not at the start of a document or elementStaxSource(javax.xml.stream.XMLEventReader eventReader)
StaxSource
with the specified XMLEventReader
.
The supplied event reader must be in XMLStreamConstants.START_DOCUMENT
or
XMLStreamConstants.START_ELEMENT
state.eventReader
- the XMLEventReader
to read fromjava.lang.IllegalStateException
- if the reader is not at the start of a document or elementjavax.xml.stream.XMLEventReader getXMLEventReader()
XMLEventReader
used by this StaxSource
. If this StaxSource
was created with an XMLStreamReader
, the result will be null
.StaxSource(javax.xml.stream.XMLEventReader)
javax.xml.stream.XMLStreamReader getXMLStreamReader()
XMLStreamReader
used by this StaxSource
. If this StaxSource
was created with an XMLEventReader
, the result will be null
.StaxSource(javax.xml.stream.XMLEventReader)
public void setInputSource(org.xml.sax.InputSource inputSource)
UnsupportedOperationException
.setInputSource
in class javax.xml.transform.sax.SAXSource
java.lang.UnsupportedOperationException
- alwayspublic void setXMLReader(org.xml.sax.XMLReader reader)
UnsupportedOperationException
.setXMLReader
in class javax.xml.transform.sax.SAXSource
java.lang.UnsupportedOperationException
- always