ACEXML_InputSource Class Reference

ACEXML_InputSource encapsulates the actual input stream with some added information. More...

#include <ACEXML/common/InputSource.h>

Collaboration diagram for ACEXML_InputSource:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ACEXML_InputSource (void)
 ACEXML_InputSource (ACEXML_CharStream *stream)
 ACEXML_InputSource (const ACEXML_Char *systemId)
virtual ~ACEXML_InputSource (void)
virtual ACEXML_CharStreamgetCharStream (void) const
virtual const ACEXML_ChargetEncoding (void) const
virtual const ACEXML_ChargetPublicId (void) const
virtual const ACEXML_ChargetSystemId (void) const
virtual void setCharStream (ACEXML_CharStream *charStream)
virtual void setEncoding (const ACEXML_Char *encoding)
virtual void setPublicId (const ACEXML_Char *publicId)
virtual void setSystemId (const ACEXML_Char *systemId)

Private Attributes

ACEXML_CharStreamcharStream_
ACEXML_Charencoding_
ACEXML_CharpublicId_
ACEXML_CharsystemId_

Detailed Description

ACEXML_InputSource encapsulates the actual input stream with some added information.

This class allows a SAX 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.

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

The SAX parser will use the InputSource 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 InputSource object belongs to the application: the SAX parser shall never modify it in any way (it may modify a copy if necessary).

See also:
ACEXML_CharStream

Definition at line 53 of file InputSource.h.


Constructor & Destructor Documentation

ACEXML_InputSource::ACEXML_InputSource void   ) 
 

Default constructor.

Definition at line 7 of file InputSource.cpp.

00008   : charStream_ (0),
00009     encoding_ (0),
00010     publicId_ (0),
00011     systemId_ (0)
00012 {
00013 }

ACEXML_InputSource::ACEXML_InputSource ACEXML_CharStream stream  )  [explicit]
 

Create a new input source with a ACEXML_Char stream. Notice that ACEXML_InputSource assumes the ownership of

Definition at line 15 of file InputSource.cpp.

00016   : charStream_ (stm),
00017     encoding_ (ACE::strnew (stm->getEncoding())),
00018     publicId_ (0),
00019     systemId_ (stm->getSystemId() ? ACE::strnew (stm->getSystemId()): 0)
00020 {
00021 }

ACEXML_InputSource::ACEXML_InputSource const ACEXML_Char systemId  ) 
 

Create a new input source with a system identifier.

Definition at line 28 of file InputSource.cpp.

References ACEXML_Char, ACEXML_StreamFactory::create_stream(), setCharStream(), and setEncoding().

00029   : charStream_ (0),
00030     encoding_ (0),
00031     publicId_ (0),
00032     systemId_ (ACE::strnew (systemId))
00033 {
00034   ACEXML_StreamFactory factory;
00035   ACEXML_CharStream* stm = factory.create_stream (this->systemId_);
00036   if (stm)
00037     {
00038       this->setCharStream (stm);
00039       this->setEncoding (this->charStream_->getEncoding());
00040     }
00041 }

ACEXML_InputSource::~ACEXML_InputSource void   )  [virtual]
 

Default destructor.

Definition at line 43 of file InputSource.cpp.

References charStream_, publicId_, and systemId_.

00044 {
00045   delete[] this->publicId_;
00046   this->publicId_ = 0;
00047   delete[] this->systemId_;
00048   this->systemId_ = 0;
00049   delete this->charStream_;
00050   this->charStream_ = 0;
00051   delete[] this->encoding_;
00052   this->encoding_ = 0;
00053 }


Member Function Documentation

ACEXML_CharStream * ACEXML_InputSource::getCharStream void   )  const [virtual]
 

Get the ACEXML_Char stream for this input source.

Definition at line 56 of file InputSource.cpp.

References charStream_.

Referenced by ACEXML_Parser::get(), ACEXML_Parser::peek(), and ACEXML_Parser::reset().

00057 {
00058   return this->charStream_;
00059 }

const ACEXML_Char * ACEXML_InputSource::getEncoding void   )  const [virtual]
 

Get the character encoding for a byte stream or URI.

Definition at line 62 of file InputSource.cpp.

Referenced by ACEXML_Parser::parse_encoding_decl().

00063 {
00064   return this->encoding_;
00065 }

const ACEXML_Char * ACEXML_InputSource::getPublicId void   )  const [virtual]
 

Get the public identifier for this input source.

Definition at line 68 of file InputSource.cpp.

References publicId_.

00069 {
00070   return this->publicId_;
00071 }

const ACEXML_Char * ACEXML_InputSource::getSystemId void   )  const [virtual]
 

Get the system identifier for this input source.

Definition at line 74 of file InputSource.cpp.

References systemId_.

Referenced by ACEXML_Parser::initialize(), and ACEXML_Parser::switch_input().

00075 {
00076   return this->systemId_;
00077 }

void ACEXML_InputSource::setCharStream ACEXML_CharStream charStream  )  [virtual]
 

Set the ACEXML_Char stream for this input source. Notice that ACEXML_InputSource assumes the ownership of

Definition at line 80 of file InputSource.cpp.

References charStream_.

Referenced by ACEXML_InputSource().

00081 {
00082   delete this->charStream_;
00083   this->charStream_ = stm;
00084 }

void ACEXML_InputSource::setEncoding const ACEXML_Char encoding  )  [virtual]
 

Set the character encoding, if known.

Definition at line 87 of file InputSource.cpp.

References ACEXML_Char, and ACE::strnew().

Referenced by ACEXML_InputSource().

00088 {
00089   delete[] this->encoding_;
00090   this->encoding_ = ACE::strnew (encoding);
00091 }

void ACEXML_InputSource::setPublicId const ACEXML_Char publicId  )  [virtual]
 

Set the public identifier for this input source.

Definition at line 94 of file InputSource.cpp.

References ACEXML_Char, publicId_, and ACE::strnew().

00095 {
00096   delete[] this->publicId_;
00097   this->publicId_ = ACE::strnew (publicId);
00098 }

void ACEXML_InputSource::setSystemId const ACEXML_Char systemId  )  [virtual]
 

Set the public identifier for this input source.

Definition at line 101 of file InputSource.cpp.

References ACEXML_Char, ACE::strnew(), and systemId_.

00102 {
00103   delete[] this->systemId_;
00104   this->systemId_ = ACE::strnew (systemId);
00105 }


Member Data Documentation

ACEXML_CharStream* ACEXML_InputSource::charStream_ [private]
 

Definition at line 122 of file InputSource.h.

Referenced by getCharStream(), setCharStream(), and ~ACEXML_InputSource().

ACEXML_Char* ACEXML_InputSource::encoding_ [private]
 

Definition at line 123 of file InputSource.h.

ACEXML_Char* ACEXML_InputSource::publicId_ [private]
 

Definition at line 124 of file InputSource.h.

Referenced by getPublicId(), setPublicId(), and ~ACEXML_InputSource().

ACEXML_Char* ACEXML_InputSource::systemId_ [private]
 

Definition at line 125 of file InputSource.h.

Referenced by getSystemId(), setSystemId(), and ~ACEXML_InputSource().


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 13:05:03 2008 for ACEXML by doxygen 1.3.6