Regina Calculation Engine
Public Member Functions | Static Public Member Functions | List of all members
regina::xml::XMLParser Class Reference

Used to parse an entire XML file. More...

#include <utilities/xmlutils.h>

Public Member Functions

 XMLParser (XMLParserCallback &callback)
 Creates a new XML parser. More...
 
virtual ~XMLParser ()
 Destroys this XML parser. More...
 
void parse_chunk (const std::string &s)
 Parses the given chunk of XML. More...
 
void finish ()
 Signals that there are no more XML chunks to parse. More...
 

Static Public Member Functions

static void parse_stream (XMLParserCallback &callback, std::istream &file, unsigned chunkSize=1024)
 Parses an entire XML file. More...
 

Detailed Description

Used to parse an entire XML file.

When particular XML components are encountered, this will be signalled by calling corresponding routines from the XMLParserCallback that is passed to the XMLParser constructor.

To parse an entire XML file, simply call static routine parse_stream(), which does not require you to create an XMLParser yourself.

If you desire more fine-grained control over the parsing process, you may create an XMLParser yourself and parse the file manually in small pieces. To do this, routine parse_chunk() should be called repeatedly with consecutive pieces of the XML file. Once the entire XML file has been sent through parse_chunk(), routine finish() should be called once to signal that processing is complete.

Python:
Not present.
Author
This class was taken and modified from the libxml++ library (http://lusis.org/~ari/xml++/).

Constructor & Destructor Documentation

regina::xml::XMLParser::XMLParser ( XMLParserCallback callback)

Creates a new XML parser.

Parameters
callbackthe object providing the routines to call when particular XML components are encountered during parsing.
regina::xml::XMLParser::~XMLParser ( )
inlinevirtual

Destroys this XML parser.

Member Function Documentation

void regina::xml::XMLParser::finish ( )
inline

Signals that there are no more XML chunks to parse.

void regina::xml::XMLParser::parse_chunk ( const std::string &  s)
inline

Parses the given chunk of XML.

Parameters
sthe chunk of XML to parse.
static void regina::xml::XMLParser::parse_stream ( XMLParserCallback callback,
std::istream &  file,
unsigned  chunkSize = 1024 
)
static

Parses an entire XML file.

The given stream will be read from until end-of-file is reached.

Parameters
callbackthe object providing the routines to call when particular XML components are encountered during parsing.
filethe stream from which the raw XML will be read.
chunkSizethe number of characters to read and process at a time (this is the size of each string that will be passed to parse_chunk()).

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

Copyright © 1999-2013, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@debian.org).