Class DOMInputImpl
- java.lang.Object
-
- org.smooks.engine.delivery.sax.ng.org.apache.xerces.dom.DOMInputImpl
-
- All Implemented Interfaces:
LSInput
public class DOMInputImpl extends Object implements LSInput
This ClassDOMInputImplrepresents a single input source for an XML entity.This Class 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
parsemethod, or as the return value of theDOMResourceResolver.resolveEntitymethod.The
DOMParserwill use theLSInputobject 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
LSInputobject 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 LSInput.See also the Document Object Model (DOM) Level 3 Abstract Schemas and Load and Save Specification.
- Version:
- $Id$
- Author:
- Gopal Sharma, SUN Microsystems Inc.
-
-
Field Summary
Fields Modifier and Type Field Description protected StringfBaseSystemIdprotected InputStreamfByteStreamprotected booleanfCertifiedTextprotected ReaderfCharStreamprotected StringfDataprotected StringfEncodingprotected StringfPublicIdprotected StringfSystemId
-
Constructor Summary
Constructors Constructor Description DOMInputImpl()Default Constructor, constructs an input sourceDOMInputImpl(String publicId, String systemId, String baseSystemId)Constructs an input source from just the public and system identifiers, leaving resolution of the entity and opening of the input stream up to the caller.DOMInputImpl(String publicId, String systemId, String baseSystemId, InputStream byteStream, String encoding)Constructs an input source from a byte stream.DOMInputImpl(String publicId, String systemId, String baseSystemId, Reader charStream, String encoding)Constructs an input source from a character stream.DOMInputImpl(String publicId, String systemId, String baseSystemId, String data, String encoding)Constructs an input source from a String.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetBaseURI()The base URI to be used (see section 5.1.4 in ) for resolving relative URIs to absolute URIs.InputStreamgetByteStream()An attribute of a language-binding dependent type that represents a stream of bytes.booleangetCertifiedText()ReadergetCharacterStream()An attribute of a language-binding dependent type that represents a stream of 16-bit units.StringgetEncoding()The character encoding, if known.StringgetPublicId()The public identifier for this input source.StringgetStringData()A string attribute that represents a sequence of 16 bit units (utf-16 encoded characters).StringgetSystemId()The system identifier, a URI reference , for this input source.voidsetBaseURI(String baseURI)The base URI to be used (see section 5.1.4 in ) for resolving relative URIs to absolute URIs.voidsetByteStream(InputStream byteStream)An attribute of a language-binding dependent type that represents a stream of bytes.voidsetCertifiedText(boolean certifiedText)voidsetCharacterStream(Reader characterStream)An attribute of a language-binding dependent type that represents a stream of 16-bit units.voidsetEncoding(String encoding)The character encoding, if known.voidsetPublicId(String publicId)The public identifier for this input source.voidsetStringData(String stringData)A string attribute that represents a sequence of 16 bit units (utf-16 encoded characters).voidsetSystemId(String systemId)The system identifier, a URI reference , for this input source.
-
-
-
Field Detail
-
fPublicId
protected String fPublicId
-
fSystemId
protected String fSystemId
-
fBaseSystemId
protected String fBaseSystemId
-
fByteStream
protected InputStream fByteStream
-
fCharStream
protected Reader fCharStream
-
fData
protected String fData
-
fEncoding
protected String fEncoding
-
fCertifiedText
protected boolean fCertifiedText
-
-
Constructor Detail
-
DOMInputImpl
public DOMInputImpl()
Default Constructor, constructs an input source
-
DOMInputImpl
public DOMInputImpl(String publicId, String systemId, String baseSystemId)
Constructs an input source from just the public and system identifiers, leaving resolution of the entity and opening of the input stream up to the caller.- Parameters:
publicId- The public identifier, if known.systemId- The system identifier. This value should always be set, if possible, and can be relative or absolute. If the system identifier is relative, then the base system identifier should be set.baseSystemId- The base system identifier. This value should always be set to the fully expanded URI of the base system identifier, if possible.
-
DOMInputImpl
public DOMInputImpl(String publicId, String systemId, String baseSystemId, InputStream byteStream, String encoding)
Constructs an input source from a byte stream.- Parameters:
publicId- The public identifier, if known.systemId- The system identifier. This value should always be set, if possible, and can be relative or absolute. If the system identifier is relative, then the base system identifier should be set.baseSystemId- The base system identifier. This value should always be set to the fully expanded URI of the base system identifier, if possible.byteStream- The byte stream.encoding- The encoding of the byte stream, if known.
-
DOMInputImpl
public DOMInputImpl(String publicId, String systemId, String baseSystemId, Reader charStream, String encoding)
Constructs an input source from a character stream.- Parameters:
publicId- The public identifier, if known.systemId- The system identifier. This value should always be set, if possible, and can be relative or absolute. If the system identifier is relative, then the base system identifier should be set.baseSystemId- The base system identifier. This value should always be set to the fully expanded URI of the base system identifier, if possible.charStream- The character stream.encoding- The original encoding of the byte stream used by the reader, if known.
-
DOMInputImpl
public DOMInputImpl(String publicId, String systemId, String baseSystemId, String data, String encoding)
Constructs an input source from a String.- Parameters:
publicId- The public identifier, if known.systemId- The system identifier. This value should always be set, if possible, and can be relative or absolute. If the system identifier is relative, then the base system identifier should be set.baseSystemId- The base system identifier. This value should always be set to the fully expanded URI of the base system identifier, if possible.data- The String Data.encoding- The original encoding of the byte stream used by the reader, if known.
-
-
Method Detail
-
getByteStream
public 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.- Specified by:
getByteStreamin interfaceLSInput
-
setByteStream
public void setByteStream(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.- Specified by:
setByteStreamin interfaceLSInput
-
getCharacterStream
public 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.- Specified by:
getCharacterStreamin interfaceLSInput
-
setCharacterStream
public void setCharacterStream(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.- Specified by:
setCharacterStreamin interfaceLSInput
-
getStringData
public 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.- Specified by:
getStringDatain interfaceLSInput
-
setStringData
public void setStringData(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.- Specified by:
setStringDatain interfaceLSInput
-
getEncoding
public 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 .- Specified by:
getEncodingin interfaceLSInput
-
setEncoding
public void setEncoding(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 .- Specified by:
setEncodingin interfaceLSInput
-
getPublicId
public 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.- Specified by:
getPublicIdin interfaceLSInput
-
setPublicId
public void setPublicId(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.- Specified by:
setPublicIdin interfaceLSInput
-
getSystemId
public 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.- Specified by:
getSystemIdin interfaceLSInput
-
setSystemId
public void setSystemId(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.- Specified by:
setSystemIdin interfaceLSInput
-
getBaseURI
public 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.- Specified by:
getBaseURIin interfaceLSInput
-
setBaseURI
public void setBaseURI(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.- Specified by:
setBaseURIin interfaceLSInput
-
getCertifiedText
public boolean getCertifiedText()
If set to true, assume that the input is certified (see section 2.13 in [XML 1.1]) when parsing [XML 1.1].- Specified by:
getCertifiedTextin interfaceLSInput
-
setCertifiedText
public void setCertifiedText(boolean certifiedText)
If set to true, assume that the input is certified (see section 2.13 in [XML 1.1]) when parsing [XML 1.1].- Specified by:
setCertifiedTextin interfaceLSInput
-
-