Class StAXSource

  extended by javax.xml.transform.sax.SAXSource
      extended by
All Implemented Interfaces:

public class StAXSource
extends SAXSource

A JAXP 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:


    // 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);

Field Summary
Fields inherited from class javax.xml.transform.sax.SAXSource
Constructor Summary
StAXSource( reader, boolean eagerQuit)
          Creates a new Source for the given XMLStreamReader.
StAXSource( reader, boolean eagerQuit, String[] inscope)
          Creates a new Source for the given XMLStreamReader.
Method Summary
Methods inherited from class javax.xml.transform.sax.SAXSource
getInputSource, getSystemId, getXMLReader, setInputSource, setSystemId, setXMLReader, sourceToInputSource
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public StAXSource( reader,
                  boolean eagerQuit)
Creates a new Source for the given XMLStreamReader.

See Also:
StAXSource(XMLStreamReader, boolean, String[])


public StAXSource( reader,
                  boolean eagerQuit,
                  String[] inscope)
Creates a new 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 Source
IllegalArgumentException - iff the reader is null
IllegalStateException - iff the reader is not pointing at either a START_DOCUMENT or START_ELEMENT event