public class StAXSource extends SAXSource
Source implementation that wraps
the specified XMLStreamReader or
XMLEventReader for use by applications that
expext a Source.
The fact that StAXSource derives from SAXSource is an implementation detail. Thus in general applications are strongly discouraged from accessing methods defined on SAXSource. In particular:
Example:
// create a StAXSource
XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new FileReader(args[0]));
Source staxSource = new StAXSource(reader);
// createa StreamResult
Result streamResult = new StreamResult(System.out);
// run the transform
TransformerFactory.newInstance().newTransformer().transform(staxSource, streamResult);
| Constructor and Description |
|---|
StAXSource(javax.xml.stream.XMLStreamReader reader,
boolean eagerQuit)
Creates a new
Source for the given
XMLStreamReader. |
StAXSource(javax.xml.stream.XMLStreamReader reader,
boolean eagerQuit,
String[] inscope)
Creates a new
Source for the given
XMLStreamReader. |
getInputSource, getSystemId, getXMLReader, setInputSource, setSystemId, setXMLReader, sourceToInputSourcepublic StAXSource(javax.xml.stream.XMLStreamReader reader, boolean eagerQuit)
Source for the given
XMLStreamReader.reader - XMLStreamReader that will be exposed as a SourceeagerQuit - if true, when the conversion is completed, leave the cursor to the last
event that was fired (such as end element)StAXSource(XMLStreamReader, boolean, String[])public StAXSource(javax.xml.stream.XMLStreamReader reader, boolean eagerQuit, @NotNull String[] inscope)
Source for the given
XMLStreamReader.
The XMLStreamReader must be pointing at either a
XMLStreamConstants.START_DOCUMENT or
XMLStreamConstants.START_ELEMENT event.reader - XMLStreamReader that will be exposed as a SourceeagerQuit - if true, when the conversion is completed, leave the cursor to the last
event that was fired (such as end element)inscope - inscope Namespaces
array of the even length of the form { prefix0, uri0, prefix1, uri1, ... }IllegalArgumentException - iff the reader is nullIllegalStateException - iff the reader is not pointing at either a
START_DOCUMENT or START_ELEMENT eventCopyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.