regina::NXMLCallback Class Reference
File I/O

Provides the callbacks for an XMLParser required to parse an entire file using a series of NXMLElementReader objects. More...

`#include <utilities/nxmlcallback.h>`

Inheritance diagram for regina::NXMLCallback:

## Public Member Functions

| NXMLCallback (NXMLElementReader &newTopReader, std::ostream &newErrStream)
| Creates a new callback object. More...
virtual | ~NXMLCallback ()
| Destroys this callback object. More...
int | getState () const
| Returns the state that this callback object is currently in. More...
void | abort ()
| Aborts processing of the XML file completely. More...
virtual void | start_document (regina::xml::XMLParser *parser)
| Called at the start of the document. More...
virtual void | end_document ()
| Called when the document is finalised. More...
virtual void | start_element (const std::string &n, const regina::xml::XMLPropertyDict &p)
| Called when an element's opening tag is encountered. More...
virtual void | end_element (const std::string &n)
| Called when an element's closing tag is encountered. More...
virtual void | characters (const std::string &s)
| Called when characters are encountered. More...
virtual void | warning (const std::string &s)
| Called when a parser warning occurs. More...
virtual void | error (const std::string &s)
| Called when a parser error occurs. More...
virtual void | fatal_error (const std::string &s)
| Called when a parser fatal error occurs. More...
virtual void | comment (const std::string &s)
| Called when a comment is encountered. More...

## Static Public Attributes

static const int | WAITING
| Signifies that the top-level XML element has not yet been seen. More...
static const int | WORKING
| Signifies that XML elements are currently being processed. More...
static const int | DONE
| Signifies that processing of all XML elements has finished. More...
static const int | ABORTED
| Signifies that XML processing was aborted. More...

## Detailed Description

Provides the callbacks for an XMLParser required to parse an entire file using a series of NXMLElementReader objects.

See the NXMLElementReader class notes for details of precisely how processing will take place.

Python:
  Not present.

## Constructor & Destructor Documentation

regina::NXMLCallback::NXMLCallback | ( | NXMLElementReader & | newTopReader,
|  | std::ostream & | newErrStream
| ) |  |

inline

Creates a new callback object.

Parameters

  newTopReader | the element reader to use for the top-level XML element. This is the only element reader that will not be destroyed once parsing has finished.
  newErrStream | the output stream to which any warning or error messages should be sent.

virtual regina::NXMLCallback::~NXMLCallback | ( |  | ) |

virtual

Destroys this callback object.

Any element reader (aside from the top-level reader) that has not yet been destroyed will have abort() called upon it and will be destroyed at this point.

## Member Function Documentation

void regina::NXMLCallback::abort | ( |  | ) |

Aborts processing of the XML file completely.

The XMLParser may continue sending information but it will be completely ignored by this NXMLCallback object from this point onwards.

All currently active readers will have NXMLElementReader::abort() called upon them and all except for the top-level reader will be destroyed.

virtual void regina::NXMLCallback::characters | ( | const std::string & | s | ) |

virtual

Called when characters are encountered.

Parameters

  s | the characters encountered.

Reimplemented from regina::xml::XMLParserCallback.

void regina::xml::XMLParserCallback::comment | ( | const std::string & | s | ) |

inline virtual inherited

Called when a comment is encountered.

Parameters

  s | the comment string.

virtual void regina::NXMLCallback::end_document | ( |  | ) |

virtual

Called when the document is finalised.

Reimplemented from regina::xml::XMLParserCallback.

virtual void regina::NXMLCallback::end_element | ( | const std::string & | n | ) |

virtual

Called when an element's closing tag is encountered.

This is called immediately after start_element() if the opening tag is in `<tag/>` format.

Parameters

  n | the name of the tag.

Reimplemented from regina::xml::XMLParserCallback.

virtual void regina::NXMLCallback::error | ( | const std::string & | s | ) |

virtual

Called when a parser error occurs.

Parameters

  s | the error message.

Reimplemented from regina::xml::XMLParserCallback.

virtual void regina::NXMLCallback::fatal_error | ( | const std::string & | s | ) |

virtual

Called when a parser fatal error occurs.

Parameters

  s | the error message.

Reimplemented from regina::xml::XMLParserCallback.

int regina::NXMLCallback::getState | ( |  | ) | const

inline

Returns the state that this callback object is currently in.

The returned value will be one of the state constants defined in this class.

Returns
  the current state of this callback object.

virtual void regina::NXMLCallback::start_document | ( | regina::xml::XMLParser * | parser | ) |

virtual

Called at the start of the document.

Parameters

  parser | the XML parser that is currently parsing this document.

Reimplemented from regina::xml::XMLParserCallback.

virtual void regina::NXMLCallback::start_element | ( | const std::string & | n,
|  | const regina::xml::XMLPropertyDict & | p
| ) |  |

virtual

Called when an element's opening tag is encountered.

Parameters

  n | the name of the tag.
  p | a dictionary of all the properties of the tag.

Reimplemented from regina::xml::XMLParserCallback.

virtual void regina::NXMLCallback::warning | ( | const std::string & | s | ) |

virtual

Called when a parser warning occurs.

Parameters

  s | the warning message.

Reimplemented from regina::xml::XMLParserCallback.

## Member Data Documentation

const int regina::NXMLCallback::ABORTED

static

Signifies that XML processing was aborted.

const int regina::NXMLCallback::DONE

static

Signifies that processing of all XML elements has finished.

const int regina::NXMLCallback::WAITING

static

Signifies that the top-level XML element has not yet been seen.

const int regina::NXMLCallback::WORKING

static

Signifies that XML elements are currently being processed.

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

- utilities/nxmlcallback.h

Copyright © 1999-2014, 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).