Skip to content

Most visited

Recently visited

navigation
Added in API level 8

SAXSource

public class SAXSource
extends Object implements Source

java.lang.Object
   ↳ javax.xml.transform.sax.SAXSource


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.

Summary

Constants

String FEATURE

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

Public constructors

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 methods

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 methods

From class java.lang.Object
From interface javax.xml.transform.Source

Constants

FEATURE

Added in API level 8
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

SAXSource

Added in API level 8
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().

See also:

SAXSource

Added in API level 8
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 XMLReader: An XMLReader to be used for the parse.
inputSource InputSource: A SAX input source reference that must be non-null and that will be passed to the reader parse method.

SAXSource

Added in API level 8
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 InputSource: An input source reference that must be non-null and that will be passed to the parse method of the reader.

Public methods

getInputSource

Added in API level 8
InputSource getInputSource ()

Get the SAX InputSource to be used for the Source.

Returns
InputSource A valid InputSource reference, or null.

getSystemId

Added in API level 8
String getSystemId ()

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

Returns
String Base URL for the Source, or null.

getXMLReader

Added in API level 8
XMLReader getXMLReader ()

Get the XMLReader to be used for the Source.

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

setInputSource

Added in API level 8
void setInputSource (InputSource inputSource)

Set the SAX InputSource to be used for the Source.

Parameters
inputSource InputSource: A valid InputSource reference.

setSystemId

Added in API level 8
void setSystemId (String systemId)

Set the system identifier for this Source. If an input source has already been set, it will set the system ID or that input source, otherwise it will create a new input source.

The system identifier is optional if there is a byte stream or a character stream, but it is still useful to provide one, since the application can use it to resolve relative URIs and can include it in error messages and warnings (the parser will attempt to open a connection to the URI only if no byte stream or character stream is specified).

Parameters
systemId String: The system identifier as a URI string.

setXMLReader

Added in API level 8
void setXMLReader (XMLReader reader)

Set the XMLReader to be used for the Source.

Parameters
reader XMLReader: A valid XMLReader or XMLFilter reference.

sourceToInputSource

Added in API level 8
InputSource sourceToInputSource (Source source)

Attempt to obtain a SAX InputSource object from a Source object.

Parameters
source Source: Must be a non-null Source reference.
Returns
InputSource An InputSource, or null if Source can not be converted.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.