Class SAXSource
- All Implemented Interfaces:
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
SAXParserFactory.setNamespaceAware(boolean awareness) method.
- Since:
- 1.4
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringIfTransformerFactory.getFeature(String)returns true when passed this value as an argument, the Transformer supports Source input of this type. -
Constructor Summary
ConstructorsConstructorDescriptionZero-argument default constructor.SAXSource(InputSource inputSource) Create aSAXSource, using a SAXInputSource.SAXSource(XMLReader reader, InputSource inputSource) Create aSAXSource, using anXMLReaderand a SAX InputSource. -
Method Summary
Modifier and TypeMethodDescriptionGet the SAX InputSource to be used for the Source.Get the base ID (URI or system ID) from where URIs will be resolved.Get the XMLReader to be used for the Source.booleanisEmpty()Indicates whether theSAXSourceobject is empty.voidsetInputSource(InputSource inputSource) Set the SAX InputSource to be used for the Source.voidsetSystemId(String systemId) Set the system identifier for this Source.voidsetXMLReader(XMLReader reader) Set the XMLReader to be used for the Source.static InputSourcesourceToInputSource(Source source) Attempt to obtain a SAX InputSource object from a Source object.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.toString()Answers a string containing a concise, human-readable description of the receiver.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Field Details
-
FEATURE
IfTransformerFactory.getFeature(String)returns true when passed this value as an argument, the Transformer supports Source input of this type.- See Also:
-
-
Constructor Details
-
SAXSource
public SAXSource()Zero-argument default constructor. If this constructor is used, and no SAX source is set using
setInputSource(InputSource inputSource), then theTransformerwill create an empty sourceInputSourceusingnew InputSource().- See Also:
-
SAXSource
Create aSAXSource, using anXMLReaderand a SAX InputSource. TheTransformerorSAXTransformerFactorywill set itself to be the reader'sContentHandler, 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.
-
SAXSource
Create aSAXSource, using a SAXInputSource. TheTransformerorSAXTransformerFactorycreates a reader (if setXMLReader is not used), sets itself as the reader'sContentHandler, 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.
-
-
Method Details
-
setXMLReader
Set the XMLReader to be used for the Source.- Parameters:
reader- A valid XMLReader or XMLFilter reference.
-
getXMLReader
Get the XMLReader to be used for the Source.- Returns:
- A valid XMLReader or XMLFilter reference, or null.
-
setInputSource
Set the SAX InputSource to be used for the Source.- Parameters:
inputSource- A valid InputSource reference.
-
getInputSource
Get the SAX InputSource to be used for the Source.- Returns:
- A valid InputSource reference, or null.
-
setSystemId
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).
- Specified by:
setSystemIdin interfaceSource- Parameters:
systemId- The system identifier as a URI string.
-
getSystemId
Get the base ID (URI or system ID) from where URIs will be resolved.
- Specified by:
getSystemIdin interfaceSource- Returns:
- Base URL for the
Source, ornull.
-
sourceToInputSource
Attempt to obtain a SAX InputSource object from a Source object.- Parameters:
source- Must be a non-null Source reference.- Returns:
- An InputSource, or null if Source can not be converted.
-
isEmpty
public boolean isEmpty()Indicates whether theSAXSourceobject is empty. Empty is defined as follows:- if the system identifier and
InputSourcearenull; - if the system identifier is
null, and theInputSourceis empty.
- if the system identifier and
-