Bayonne2 / Common C++ 2 Framework
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes
XMLStream Class Referenceabstract

This class impliments a basic XML stream parser that can be used to examine an XML resource thru virtual I/O methods. More...

#include <xml.h>

Inheritance diagram for XMLStream:
Inheritance graph
[legend]
Collaboration diagram for XMLStream:
Collaboration graph
[legend]

Public Member Functions

virtual bool  open (const char *resource)
  May perform an open operation on behalf of a parsed resource. More...
 
virtual void  close (void)
  May perform a close operation of an i/o source when the parser has completed operation. More...
 
virtual Slog::Level  getLogging (void)
  Get error logging level. More...
 
virtual void  comment (const unsigned char *text, size_t len)
  Virtual to receive embedded comments in an XML document being parsed. More...
 
virtual int  read (unsigned char *buffer, size_t len)=0
  Read method to aquire data for the parser. More...
 
virtual void  characters (const unsigned char *text, size_t len)=0
  Virtual to receive character text extracted from the document in the current element. More...
 
virtual void  startDocument (void)
  Identify start of document event. More...
 
virtual void  endDocument (void)
  Identify end of document event. More...
 
virtual void  startElement (const unsigned char *name, const unsigned char **attr)=0
  Identify start of an element in the document. More...
 
virtual void  endElement (const unsigned char *name)=0
  Identify end of an element in the document. More...
 
bool  parse (const char *resource=NULL)
  Parse a resource as a stream thru the virtual read method. More...
 

Protected Member Functions

virtual  ~XMLStream ()
 

Private Types

enum   {
  TAG, CDATA, COMMENT, DTD,
  AMP, NONE
}
 

Private Member Functions

bool  parseChunk (const char *chunk, size_t len)
 
void  parseInit (void)
 
bool  parseTag (void)
 
void  putData (char c)
 
void  clrData (void)
 

Private Attributes

int  ecount
 
int  dcount
 
enum XMLStream:: { ... }   state
 
char  dbuf [8192]
 
unsigned  dp
 

Detailed Description

This class impliments a basic XML stream parser that can be used to examine an XML resource thru virtual I/O methods.

This class must be derived into one that can impliment the physical I/O required to parse actual data. A mixer class using XMLStream and URLStream would seem a likely combination for this purpose.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m XML Stream Parser (SAX)

Definition at line 73 of file xml.h.

Member Enumeration Documentation

anonymous enum
private
Enumerator
TAG 
CDATA 
COMMENT 
DTD 
AMP 
NONE 

Definition at line 77 of file xml.h.

Constructor & Destructor Documentation

virtual XMLStream::~XMLStream ( )
protectedvirtual

Member Function Documentation

virtual void XMLStream::characters ( const unsigned char *  text,
size_t  len 
)
pure virtual

Virtual to receive character text extracted from the document in the current element.

Parameters
text received.
len length of text received.
virtual void XMLStream::close ( void  )
virtual

May perform a close operation of an i/o source when the parser has completed operation.

void XMLStream::clrData ( void  )
private
virtual void XMLStream::comment ( const unsigned char *  text,
size_t  len 
)
virtual

Virtual to receive embedded comments in an XML document being parsed.

Parameters
text text comment extracted.
len length of comment.
virtual void XMLStream::endDocument ( void  )
virtual

Identify end of document event.

virtual void XMLStream::endElement ( const unsigned char *  name )
pure virtual

Identify end of an element in the document.

Parameters
name of element found.
virtual Slog::Level XMLStream::getLogging ( void  )
virtual

Get error logging level.

Returns
error logging level.
virtual bool XMLStream::open ( const char *  resource )
virtual

May perform an open operation on behalf of a parsed resource.

In some cases, the parser may be merged with a class that already has performed some kind of open, and this method can then be ignored.

Returns
true if open is successful.
Parameters
resource passed to Parse methods.
bool XMLStream::parse ( const char *  resource = NULL )

Parse a resource as a stream thru the virtual read method.

Returns
true if well formed document has been fully parsed.
Parameters
resource optional name of resource.
bool XMLStream::parseChunk ( const char *  chunk,
size_t  len 
)
private
void XMLStream::parseInit ( void  )
private
bool XMLStream::parseTag ( void  )
private
void XMLStream::putData ( char  c )
private
virtual int XMLStream::read ( unsigned char *  buffer,
size_t  len 
)
pure virtual

Read method to aquire data for the parser.

Returns
number of bytes actually read.
Parameters
buffer to read data into.
len number of bytes to read.
virtual void XMLStream::startDocument ( void  )
virtual

Identify start of document event.

virtual void XMLStream::startElement ( const unsigned char *  name,
const unsigned char **  attr 
)
pure virtual

Identify start of an element in the document.

Parameters
name of element found.
attr list of attributes extracted.

Field Documentation

char XMLStream::dbuf[8192]
private

Definition at line 78 of file xml.h.

int XMLStream::dcount
private

Definition at line 76 of file xml.h.

unsigned XMLStream::dp
private

Definition at line 79 of file xml.h.

int XMLStream::ecount
private

Definition at line 76 of file xml.h.

enum { ... } XMLStream::state

The documentation for this class was generated from the following file:

Generated on Dec 21, 2017 for commoncpp2-1.8.1, ccrtp-1.7.2, libzrtpcpp-2.3.4, ccscript3-1.1.7, ccaudio2-1.0.0 and bayonne2-2.3.2 (after installation in /usr/local/) by   doxygen 1.8.6

AltStyle によって変換されたページ (->オリジナル) /