![]()
|
Glib::Markup::Parser Class ReferenceThe abstract markup parser base class.
More...
|
Public Types | |
typedef std::map< Glib::ustring, Glib::ustring, Glib::Markup::AttributeKeyLess > | AttributeMap |
Public Methods | |
virtual | ~Parser ()=0 |
Protected Methods | |
Parser () | |
Constructs a Parser object. | |
virtual void | on_start_element (ParseContext& context, const Glib::ustring& element_name, const AttributeMap& attributes) |
Called for open tags <foo bar="baz"> . | |
virtual void | on_end_element (ParseContext& context, const Glib::ustring& element_name) |
Called for close tags </foo> . | |
virtual void | on_text (ParseContext& context, const Glib::ustring& text) |
Called for character data. | |
virtual void | on_passthrough (ParseContext& context, const Glib::ustring& passthrough_text) |
Called for strings that should be re-saved verbatim in this same position, but are not otherwise interpretable. | |
virtual void | on_error (ParseContext& context, const MarkupError& error) |
Called on error, including one thrown by an overridden virtual method. |
To implement a parser for your markup format, derive from Glib::Markup::Parser and implement the virtual methods.
You don't have to override all of the virtual methods. If a particular method is not implement the data passed to it will be ignored. Except for the error method, any of these callbacks can throw an error exception; in particular the MarkupError::UNKNOWN_ELEMENT, MarkupError::UNKNOWN_ATTRIBUTE, and MarkupError::INVALID_CONTENT errors are intended to be thrown from these overridden methods. If you throw an error from a method, Glib::Markup::ParseContext::parse() will report that error back to its caller.
|
|
|
|
|
Constructs a Parser object. Note that Markup::Parser is an abstract class which can't be instantiated directly. To implement the parser for your markup format, derive from Markup::Parser and implement the virtual methods. |
|
Called for close tags This virtual method is invoked when the closing tag of an element is seen.
|
|
Called on error, including one thrown by an overridden virtual method.
|
|
Called for strings that should be re-saved verbatim in this same position, but are not otherwise interpretable. This virtual method is invoked for comments, processing instructions and doctype declarations; if you're re-writing the parsed document, write the passthrough text back out in the same position.
|
|
Called for open tags This virtual method is invoked when the opening tag of an element is seen.
|
|
Called for character data. This virtual method is invoked when some text is seen (text is always inside an element).
|