Package com.sun.xml.ws.util.xml
Class StAXSource
- java.lang.Object
-
- javax.xml.transform.sax.SAXSource
-
- com.sun.xml.ws.util.xml.StAXSource
-
- All Implemented Interfaces:
Source
public class StAXSource extends SAXSource
A JAXPSourceimplementation that wraps the specifiedXMLStreamReaderorXMLEventReaderfor use by applications that expect aSource.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:
- The setXMLReader and setInputSource methods shall never be called.
- The XMLReader object obtained by the getXMLReader method shall be used only for parsing the InputSource object returned by the getInputSource method.
- The InputSource object obtained by the getInputSource method shall be used only for being parsed by the XMLReader object returned by the getXMLReader method.
Example:
// create a StAXSource XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new FileReader(args[0])); Source staxSource = new StAXSource(reader); // create a StreamResult Result streamResult = new StreamResult(System.out); // run the transform TransformerFactory.newInstance().newTransformer().transform(staxSource, streamResult);- Version:
- 1.0
- Author:
- Ryan.Shoemaker@Sun.COM
-
-
Constructor Summary
Constructors Constructor Description StAXSource(XMLStreamReader reader, boolean eagerQuit)Creates a newSourcefor the givenXMLStreamReader.StAXSource(XMLStreamReader reader, boolean eagerQuit, String[] inscope)Creates a newSourcefor the givenXMLStreamReader.
-
Method Summary
-
Methods inherited from class javax.xml.transform.sax.SAXSource
getInputSource, getSystemId, getXMLReader, isEmpty, setInputSource, setSystemId, setXMLReader, sourceToInputSource
-
-
-
-
Constructor Detail
-
StAXSource
public StAXSource(XMLStreamReader reader, boolean eagerQuit)
Creates a newSourcefor the givenXMLStreamReader.- Parameters:
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)- See Also:
StAXSource(XMLStreamReader, boolean, String[])
-
StAXSource
public StAXSource(XMLStreamReader reader, boolean eagerQuit, @NotNull String[] inscope)
Creates a newSourcefor the givenXMLStreamReader. The XMLStreamReader must be pointing at either aXMLStreamConstants.START_DOCUMENTorXMLStreamConstants.START_ELEMENTevent.- Parameters:
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, ... }- Throws:
IllegalArgumentException- iff the reader is nullIllegalStateException- iff the reader is not pointing at either a START_DOCUMENT or START_ELEMENT event
-
-