This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.xml.transform.sax
class SAXSource

java.lang.Object extended by javax.xml.transform.sax.SAXSource
All Implemented Interfaces:
Source
Direct Known Subclasses:
JAXBSource

Most common ways to construct:

XMLReader reader = …;
InputSource inputSource = …;

SAXSource saxSource = new SAXSource(reader, inputSource);

Based on 15 examples

 

InputSource is = …;

SAXSource source = new SAXSource(is);

Based on 14 examples


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 {@link javax.xml.parsers.SAXParserFactory#setNamespaceAware(boolean awareness)} method.


Field Summary
static String FEATURE
          If javax.xml.transform.TransformerFactory.getFeature returns true when passed this value as an argument, the Transformer supports Source input of this type.
 
Constructor Summary

          Zero-argument default constructor.
SAXSource(InputSource inputSource)

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

          Create a SAXSource, using an org.xml.sax.XMLReader and a SAX InputSource.
 
Method Summary
 InputSource

          Get the SAX InputSource to be used for the Source.
 String

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

          Get the XMLReader to be used for the Source.
 void

          Set the SAX InputSource to be used for the Source.
 void
setSystemId(String systemId)

          Set the system identifier for this Source.
 void

          Set the XMLReader to be used for the Source.
static InputSource

          Attempt to obtain a SAX InputSource object from a Source object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FEATURE

public static final String FEATURE
If {@link javax.xml.transform.TransformerFactory#getFeature} returns true when passed this value as an argument, the Transformer supports Source input of this type.
Constructor Detail

SAXSource

public SAXSource()

Zero-argument default constructor. If this constructor is used, and no SAX source is set using {@link #setInputSource(InputSource inputSource)} , then the Transformer will create an empty source {@link org.xml.sax.InputSource} using {@link org.xml.sax.InputSource#InputSource() new InputSource()}.


SAXSource

public SAXSource(InputSource inputSource)
Create a SAXSource, using a SAX InputSource. The {@link javax.xml.transform.Transformer} or {@link javax.xml.transform.sax.SAXTransformerFactory} creates a reader via {@link org.xml.sax.helpers.XMLReaderFactory} (if setXMLReader is not used), sets itself as the reader's {@link org.xml.sax.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.

SAXSource

public SAXSource(XMLReader reader,
                 InputSource inputSource)
Create a SAXSource, using an {@link org.xml.sax.XMLReader} and a SAX InputSource. The {@link javax.xml.transform.Transformer} or {@link javax.xml.transform.sax.SAXTransformerFactory} will set itself to be the reader's {@link org.xml.sax.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.
Method Detail

getInputSource

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

Returns:
A valid InputSource reference, or null.

getSystemId

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.

getXMLReader

public XMLReader getXMLReader()
Get the XMLReader to be used for the Source.

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

setInputSource

public void setInputSource(InputSource inputSource)
Set the SAX InputSource to be used for the Source.

Parameters:
inputSource - A valid InputSource reference.

setSystemId

public 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 - The system identifier as a URI string.

setXMLReader

public void setXMLReader(XMLReader reader)
Set the XMLReader to be used for the Source.

Parameters:
reader - A valid XMLReader or XMLFilter reference.

sourceToInputSource

public static InputSource sourceToInputSource(Source 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.


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.