org.apache.xerces.dom3.ls
Interface DOMInputSource


public interface DOMInputSource

This interface represents a single input source for an XML entity.

This interface allows an application to encapsulate information about an input source in a single object, which may include a public identifier, a system identifier, a byte stream (possibly with a specified encoding), and/or a character stream.

The exact definitions of a byte stream and a character stream are binding dependent.

There are two places that the application will deliver this input source to the parser: as the argument to the parse method, or as the return value of the DOMEntityResolver.resolveEntity method.

The DOMBuilder will use the DOMInputSource object to determine how to read XML input. If there is a character stream available, the parser will read that stream directly; if not, the parser will use a byte stream, if available; if neither a character stream nor a byte stream is available, the parser will attempt to open a URI connection to the resource identified by the system identifier.

An DOMInputSource object belongs to the application: the parser shall never modify it in any way (it may modify a copy if necessary). Eventhough all attributes in this interface are writable the DOM implementation is expected to never mutate a DOMInputSource.

See also the Document Object Model (DOM) Level 3 Abstract Schemas and Load and Save Specification.


Method Summary
 java.lang.String getBaseURI()
          The base URI to be used (see section 5.1.4 in ) for resolving relative URIs to absolute URIs.
 java.io.InputStream getByteStream()
          An attribute of a language-binding dependent type that represents a stream of bytes.
 java.io.Reader getCharacterStream()
          An attribute of a language-binding dependent type that represents a stream of 16-bit units.
 java.lang.String getEncoding()
          The character encoding, if known.
 java.lang.String getPublicId()
          The public identifier for this input source.
 java.lang.String getStringData()
          A string attribute that represents a sequence of 16 bit units (utf-16 encoded characters).
 java.lang.String getSystemId()
          The system identifier, a URI reference , for this input source.
 void setBaseURI(java.lang.String baseURI)
          The base URI to be used (see section 5.1.4 in ) for resolving relative URIs to absolute URIs.
 void setByteStream(java.io.InputStream byteStream)
          An attribute of a language-binding dependent type that represents a stream of bytes.
 void setCharacterStream(java.io.Reader characterStream)
          An attribute of a language-binding dependent type that represents a stream of 16-bit units.
 void setEncoding(java.lang.String encoding)
          The character encoding, if known.
 void setPublicId(java.lang.String publicId)
          The public identifier for this input source.
 void setStringData(java.lang.String stringData)
          A string attribute that represents a sequence of 16 bit units (utf-16 encoded characters).
 void setSystemId(java.lang.String systemId)
          The system identifier, a URI reference , for this input source.
 

Method Detail

getByteStream

public java.io.InputStream getByteStream()
An attribute of a language-binding dependent type that represents a stream of bytes.
The parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself.
If the application knows the character encoding of the byte stream, it should set the encoding property. Setting the encoding in this way will override any encoding specified in the XML declaration itself.

setByteStream

public void setByteStream(java.io.InputStream byteStream)
An attribute of a language-binding dependent type that represents a stream of bytes.
The parser will ignore this if there is also a character stream specified, but it will use a byte stream in preference to opening a URI connection itself.
If the application knows the character encoding of the byte stream, it should set the encoding property. Setting the encoding in this way will override any encoding specified in the XML declaration itself.

getCharacterStream

public java.io.Reader getCharacterStream()
An attribute of a language-binding dependent type that represents a stream of 16-bit units. Application must encode the stream using UTF-16 (defined in and Amendment 1 of ).
If a character stream is specified, the parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.

setCharacterStream

public void setCharacterStream(java.io.Reader characterStream)
An attribute of a language-binding dependent type that represents a stream of 16-bit units. Application must encode the stream using UTF-16 (defined in and Amendment 1 of ).
If a character stream is specified, the parser will ignore any byte stream and will not attempt to open a URI connection to the system identifier.

getStringData

public java.lang.String getStringData()
A string attribute that represents a sequence of 16 bit units (utf-16 encoded characters).
If string data is available in the input source, the parser will ignore the character stream and the byte stream and will not attempt to open a URI connection to the system identifier.

setStringData

public void setStringData(java.lang.String stringData)
A string attribute that represents a sequence of 16 bit units (utf-16 encoded characters).
If string data is available in the input source, the parser will ignore the character stream and the byte stream and will not attempt to open a URI connection to the system identifier.

getEncoding

public java.lang.String getEncoding()
The character encoding, if known. The encoding must be a string acceptable for an XML encoding declaration ( section 4.3.3 "Character Encoding in Entities").
This attribute has no effect when the application provides a character stream. For other sources of input, an encoding specified by means of this attribute will override any encoding specified in the XML claration or the Text Declaration, or an encoding obtained from a higher level protocol, such as HTTP .

setEncoding

public void setEncoding(java.lang.String encoding)
The character encoding, if known. The encoding must be a string acceptable for an XML encoding declaration ( section 4.3.3 "Character Encoding in Entities").
This attribute has no effect when the application provides a character stream. For other sources of input, an encoding specified by means of this attribute will override any encoding specified in the XML claration or the Text Declaration, or an encoding obtained from a higher level protocol, such as HTTP .

getPublicId

public java.lang.String getPublicId()
The public identifier for this input source. The public identifier is always optional: if the application writer includes one, it will be provided as part of the location information.

setPublicId

public void setPublicId(java.lang.String publicId)
The public identifier for this input source. The public identifier is always optional: if the application writer includes one, it will be provided as part of the location information.

getSystemId

public java.lang.String getSystemId()
The system identifier, a URI reference , for this 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 fetch the ressource identifier by the URI reference only if there is no byte stream or character stream specified).
If the application knows the character encoding of the object pointed to by the system identifier, it can register the encoding by setting the encoding attribute.
If the system ID is a relative URI reference (see section 5 in ), the behavior is implementation dependent.

setSystemId

public void setSystemId(java.lang.String systemId)
The system identifier, a URI reference , for this 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 fetch the ressource identifier by the URI reference only if there is no byte stream or character stream specified).
If the application knows the character encoding of the object pointed to by the system identifier, it can register the encoding by setting the encoding attribute.
If the system ID is a relative URI reference (see section 5 in ), the behavior is implementation dependent.

getBaseURI

public java.lang.String getBaseURI()
The base URI to be used (see section 5.1.4 in ) for resolving relative URIs to absolute URIs. If the baseURI is itself a relative URI, the behavior is implementation dependent.

setBaseURI

public void setBaseURI(java.lang.String baseURI)
The base URI to be used (see section 5.1.4 in ) for resolving relative URIs to absolute URIs. If the baseURI is itself a relative URI, the behavior is implementation dependent.


Copyright © 1999-2002 Apache XML Project. All Rights Reserved.