SAXSource (Java Platform SE 7 ) (original) (raw)
- javax.xml.transform.sax.SAXSource
All Implemented Interfaces:
Source
Direct Known Subclasses:
JAXBSource
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 theSAXParserFactory.setNamespaceAware(boolean awareness) method.
Field Summary
Fields
Modifier and Type Field and Description static String FEATURE If TransformerFactory.getFeature(java.lang.String) returns true when passed this value as an argument, the Transformer supports Source input of this type. Constructor Summary
Constructors
Constructor and Description SAXSource() Zero-argument default constructor. SAXSource(InputSource inputSource) Create a SAXSource, using a SAX InputSource. SAXSource(XMLReader reader,InputSource inputSource) Create a SAXSource, using an XMLReader and a SAX InputSource. Method Summary
Methods
Modifier and Type Method and Description 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. * ### Methods inherited from class java.lang.[Object](../../../../java/lang/Object.html "class in java.lang") `[clone](../../../../java/lang/Object.html#clone%28%29), [equals](../../../../java/lang/Object.html#equals%28java.lang.Object%29), [finalize](../../../../java/lang/Object.html#finalize%28%29), [getClass](../../../../java/lang/Object.html#getClass%28%29), [hashCode](../../../../java/lang/Object.html#hashCode%28%29), [notify](../../../../java/lang/Object.html#notify%28%29), [notifyAll](../../../../java/lang/Object.html#notifyAll%28%29), [toString](../../../../java/lang/Object.html#toString%28%29), [wait](../../../../java/lang/Object.html#wait%28%29), [wait](../../../../java/lang/Object.html#wait%28long%29), [wait](../../../../java/lang/Object.html#wait%28long,%20int%29)`
Field Detail
* #### FEATURE public static final [String](../../../../java/lang/String.html "class in java.lang") FEATURE See Also: [Constant Field Values](../../../../constant-values.html#javax.xml.transform.sax.SAXSource.FEATURE)
Constructor Detail
* #### SAXSource public SAXSource() See Also: [Transformer.transform(Source xmlSource, Result outputTarget)](../../../../javax/xml/transform/Transformer.html#transform%28javax.xml.transform.Source,%20javax.xml.transform.Result%29) * #### SAXSource public SAXSource([XMLReader](../../../../org/xml/sax/XMLReader.html "interface in org.xml.sax") reader, [InputSource](../../../../org/xml/sax/InputSource.html "class in org.xml.sax") 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 public SAXSource([InputSource](../../../../org/xml/sax/InputSource.html "class in org.xml.sax") 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 Detail
* #### setXMLReader public void setXMLReader([XMLReader](../../../../org/xml/sax/XMLReader.html "interface in org.xml.sax") reader) Set the XMLReader to be used for the Source. Parameters: `reader` \- A valid XMLReader or XMLFilter reference. * #### getXMLReader public [XMLReader](../../../../org/xml/sax/XMLReader.html "interface in org.xml.sax") getXMLReader() Get the XMLReader to be used for the Source. Returns: A valid XMLReader or XMLFilter reference, or null. * #### setInputSource public void setInputSource([InputSource](../../../../org/xml/sax/InputSource.html "class in org.xml.sax") inputSource) Set the SAX InputSource to be used for the Source. Parameters: `inputSource` \- A valid InputSource reference. * #### getInputSource public [InputSource](../../../../org/xml/sax/InputSource.html "class in org.xml.sax") getInputSource() Get the SAX InputSource to be used for the Source. Returns: A valid InputSource reference, or null. * #### setSystemId public void setSystemId([String](../../../../java/lang/String.html "class in java.lang") 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). **Specified by:** `[setSystemId](../../../../javax/xml/transform/Source.html#setSystemId%28java.lang.String%29)` in interface `[Source](../../../../javax/xml/transform/Source.html "interface in javax.xml.transform")` Parameters: `systemId` \- The system identifier as a URI string. * #### getSystemId public [String](../../../../java/lang/String.html "class in java.lang") getSystemId() Get the base ID (URI or system ID) from where URIs will be resolved. **Specified by:** `[getSystemId](../../../../javax/xml/transform/Source.html#getSystemId%28%29)` in interface `[Source](../../../../javax/xml/transform/Source.html "interface in javax.xml.transform")` Returns: Base URL for the `Source`, or `null`. * #### sourceToInputSource public static [InputSource](../../../../org/xml/sax/InputSource.html "class in org.xml.sax") sourceToInputSource([Source](../../../../javax/xml/transform/Source.html "interface in javax.xml.transform") source) 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.
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2020, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.