SAXSource

public class SAXSource extends Object
implements Source

Acts as an holder for SAX-style Source.

Note that XSLT requires namespace support. Attempting to transform an input source that is not generated with a namespace-aware parser may result in errors. Parsers can be made namespace aware by calling the setNamespaceAware(boolean) method.

Constant Summary

String FEATURE If getFeature(String) returns true when passed this value as an argument, the Transformer supports Source input of this type.

Public Constructor Summary

SAXSource()

Zero-argument default constructor.

SAXSource(XMLReader reader, InputSource inputSource)
Create a SAXSource, using an XMLReader and a SAX InputSource.
SAXSource(InputSource inputSource)
Create a SAXSource, using a SAX InputSource.

Public Method Summary

InputSource
getInputSource()
Get the SAX InputSource to be used for the Source.
String
getSystemId()

Get the base ID (URI or system ID) from where URIs will be resolved.

XMLReader
getXMLReader()
Get the XMLReader to be used for the Source.
void
setInputSource(InputSource inputSource)
Set the SAX InputSource to be used for the Source.
void
setSystemId(String systemId)
Set the system identifier for this Source.
void
setXMLReader(XMLReader reader)
Set the XMLReader to be used for the Source.
static InputSource
sourceToInputSource(Source source)
Attempt to obtain a SAX InputSource object from a Source object.

Inherited Method Summary

Constants

public static final String FEATURE

If getFeature(String) returns true when passed this value as an argument, the Transformer supports Source input of this type.

Constant Value: "http://javax.xml.transform.sax.SAXSource/feature"

Public Constructors

public SAXSource ()

Zero-argument default constructor. If this constructor is used, and no SAX source is set using setInputSource(InputSource) , then the Transformer will create an empty source InputSource using new InputSource().

public SAXSource (XMLReader reader, InputSource inputSource)

Create a SAXSource, using an XMLReader and a SAX InputSource. The Transformer or SAXTransformerFactory will set itself to be the reader's ContentHandler, and then will call reader.parse(inputSource).

Parameters
reader An XMLReader to be used for the parse.
inputSource A SAX input source reference that must be non-null and that will be passed to the reader parse method.

public SAXSource (InputSource inputSource)

Create a SAXSource, using a SAX InputSource. The Transformer or SAXTransformerFactory creates a reader via XMLReaderFactory (if setXMLReader is not used), sets itself as the reader's ContentHandler, and calls reader.parse(inputSource).

Parameters
inputSource An input source reference that must be non-null and that will be passed to the parse method of the reader.

Public Methods

public InputSource getInputSource ()

Get the SAX InputSource to be used for the Source.

Returns
  • A valid InputSource reference, or null.

public String getSystemId ()

Get the base ID (URI or system ID) from where URIs will be resolved.

Returns
  • Base URL for the Source, or null.

public XMLReader getXMLReader ()

Get the XMLReader to be used for the Source.

Returns
  • A valid XMLReader or XMLFilter reference, or null.
<