Main Page | Directories | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

moot::mootExpatParser Class Reference

C++ Wrapper for expat XML parsers.

#include <mootExpatParser.h>

Inheritance diagram for moot::mootExpatParser:

Inheritance graph
[legend]
Collaboration diagram for moot::mootExpatParser:

Collaboration graph
[legend]
List of all members.

Public Member Functions

Constructors etc.
Input Selection
Parsing
Utilities
Handlers

Static Public Member Functions

Expat Callback Wrappers

Public Attributes

I/O Data
Internal Data

Constructor & Destructor Documentation

moot::mootExpatParser::mootExpatParser size_t  bufsize = 8192,
const std::string &  encoding = ""
 

Default constructor:

Parameters:
bufsize length of parse buffer for expat
encoding override document input encoding (broken?)

virtual moot::mootExpatParser::~mootExpatParser void   )  [virtual]
 

Default destructor


Member Function Documentation

void moot::mootExpatParser::_xp_CharacterDataHandler mootExpatParser mp,
const XML_Char *  s,
int  len
[inline, static]
 

void moot::mootExpatParser::_xp_CommentHandler mootExpatParser mp,
const XML_Char *  s
[inline, static]
 

void moot::mootExpatParser::_xp_DefaultHandler mootExpatParser mp,
const XML_Char *  s,
int  len
[inline, static]
 

void moot::mootExpatParser::_xp_EndElementHandler mootExpatParser mp,
const char *  el
[inline, static]
 

void moot::mootExpatParser::_xp_StartElementHandler mootExpatParser mp,
const char *  el,
const char **  attr
[inline, static]
 

void moot::mootExpatParser::_xp_XmlDeclHandler mootExpatParser mp,
const XML_Char *  version,
const XML_Char *  encoding,
int  standalone
[inline, static]
 

virtual void moot::mootExpatParser::carp char *  fmt,
  ...
[virtual]
 

complain

Reimplemented in moot::TokenReaderExpat.

virtual void moot::mootExpatParser::CharacterDataHandler const XML_Char *  s,
int  len
[inline, virtual]
 

Handle character data

Reimplemented in moot::TokenReaderExpat.

virtual void moot::mootExpatParser::close void   )  [virtual]
 

Finish input from currently selected source & perform any required cleanup operations. This method should always be called before selecting a new input source.

Descendants may override this method.

Reimplemented in moot::TokenReaderExpat.

virtual void moot::mootExpatParser::CommentHandler const XML_Char *  s  )  [inline, virtual]
 

Handle comments

Reimplemented in moot::TokenReaderExpat.

virtual void moot::mootExpatParser::context_dump FILE *  tofile = 0  )  [virtual]
 

Print current parser context (in real input encoding)

virtual std::string moot::mootExpatParser::context_string void   )  [inline, virtual]
 

Get current parser context as a std::string

virtual void moot::mootExpatParser::DefaultHandler const XML_Char *  s,
int  len
[inline, virtual]
 

Handle any other document-internal data (no entity expansion!)

Reimplemented in moot::TokenReaderExpat.

virtual void moot::mootExpatParser::EndCdataSectionHandler void   )  [inline, virtual]
 

Handle end of CDATA sections

virtual void moot::mootExpatParser::EndElementHandler const char *  el  )  [inline, virtual]
 

Handle end elements

Reimplemented in moot::TokenReaderExpat.

virtual void moot::mootExpatParser::from_buffer const void *  buf,
size_t  len
[virtual]
 

Select input from a C memory-buffer. Caller is responsible for allocation and de-allocation. Descendants using C memory-buffer input may override this method. Default implementation calls from_mstream().

Reimplemented in moot::TokenReaderExpat.

virtual void moot::mootExpatParser::from_cxxstream std::istream &  is  )  [virtual]
 

Select input from a C++ stream. Caller is responsible for allocation and de-allocation. Descendants using C++ stream input may override this method. Default implementation calls from_mstream().

Reimplemented in moot::TokenReaderExpat.

virtual void moot::mootExpatParser::from_fd int  fd  )  [inline, virtual]
 

Select input from a file descriptor. Caller is responsible for opening and closing the stream. Descendants using file descriptor input may override this method. No default implementation.

Reimplemented in moot::TokenReaderExpat.

virtual void moot::mootExpatParser::from_file FILE *  file  )  [virtual]
 

Select input from a C stream. Caller is responsible for opening and closing the stream. Descendants using C stream input may override this method. Default implementation calls from_mstream().

Reimplemented in moot::TokenReaderExpat.

virtual void moot::mootExpatParser::from_filename const char *  filename  )  [virtual]
 

Select input from a named file. Descendants using named file input may override this method. The filename "-" may be used to specify stdin. Default implementation calls from_mstream().

Reimplemented in moot::TokenReaderExpat.

virtual void moot::mootExpatParser::from_mstream mootio::mistream mistream  )  [inline, virtual]
 

Select input from a mootio::mistream reference. This is the basic case. Descendant classes may override this method.

Reimplemented in moot::TokenReaderExpat.

virtual void moot::mootExpatParser::from_mstream mootio::mistream mistreamp  )  [virtual]
 

Select input from a mootio::mistream pointer. This is the basic case. Descendant classes may override this method.

Reimplemented in moot::TokenReaderExpat.

virtual void moot::mootExpatParser::from_string const char *  s  )  [inline, virtual]
 

Select input from a NUL-terminated C string. Caller is responsible for allocation and de-allocation. Descendants using C string input may override this method. Default implementation calls from_cbuffer(s,len).

bool moot::mootExpatParser::parse_all mootio::mistream in = 0  ) 
 

Parse the entirety of the stream , which defaults to the currently selected input stream. Only minimal sanity checks are performed.

bool moot::mootExpatParser::parse_buffer const char *  buf,
size_t  buflen
 

Parse from your very own string buffer.

Warning:
This method is not intended to be called incrementally, so the stack is cleared before parsing the buffer. If you want to parse incrementally, use parse_chunk()
: buffer to parse : number of bytes to parse from the buffer : input-name to use for errors/warnings : whether this is the final bit of the document

virtual bool moot::mootExpatParser::parse_check void   )  [virtual]
 

Check whether object is in a sane state for parsing, printing warning messages if this is not the case

bool moot::mootExpatParser::parse_chunk int &  nbytes,
int &  is_final,
mootio::mistream in = 0
 

Read in and parse the next chunk from input source using an internal buffer. Returns true on success, false on failure.

Parameters:
nbytes number of bytes read from file will be stored here
is_final will be 1 if the file ended, 0 otherwise
in input stream to read from (default is to use current selection)
Warning:
you should have called reset() at least once before calling this method -- no sanity checks are performed!

bool moot::mootExpatParser::parse_file FILE *  infile = stdin,
const std::string &  in_name = ""
 

Parse a C stream until EOF

bool moot::mootExpatParser::parse_filename const std::string &  filename  ) 
 

Parse an entire named file

virtual void moot::mootExpatParser::ProcessingInstructionHandler const XML_Char *  s,
const XML_Char *  target,
const XML_Char *  data
[inline, virtual]
 

Handle PIs

virtual void moot::mootExpatParser::reset void   )  [virtual]
 

Reset parser state: re-initializes the internal xml buffer, as well as the expat parser, its encoding and handlers.

Reimplemented in moot::TokenReaderExpat.

virtual void moot::mootExpatParser::setEncoding const std::string &  encoding = ""  )  [inline, virtual]
 

Override document encoding. Implicitly reset()s the parser.

virtual void moot::mootExpatParser::StartCdataSectionHandler void   )  [inline, virtual]
 

Handle start of CDATA sections

virtual void moot::mootExpatParser::StartElementHandler const char *  el,
const char **  attr
[inline, virtual]
 

Handle start elements

Reimplemented in moot::TokenReaderExpat.

virtual void moot::mootExpatParser::XmlDeclHandler const XML_Char *  version,
const XML_Char *  encoding,
int  standalone
[inline, virtual]
 

Handle XML declarations

Reimplemented in moot::TokenReaderExpat.

virtual void moot::mootExpatParser::xpcarp char *  fmt,
  ...
[virtual]
 

Complain initiated by expat


Member Data Documentation

XML_Parser moot::mootExpatParser::parser
 

char* moot::mootExpatParser::xml_buf
 

size_t moot::mootExpatParser::xml_buflen
 

std::string moot::mootExpatParser::xml_encoding
 

mootio::mistream* moot::mootExpatParser::xp_istream
 

bool moot::mootExpatParser::xp_istream_created
 


The documentation for this class was generated from the following file:
Generated on Mon Jun 27 13:05:27 2005 for libmoot by  doxygen 1.3.8-20040913