Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::G::MarkupParser Class Reference

A GMarkupParser C++ wrapper interface. More...

#include <xfc/glib/markup.hh>

List of all members.

Protected Member Functions

Callback Handlers

Detailed Description

A GMarkupParser C++ wrapper interface.

MarkupParser is an abstract interface class that be can be derived from, or multiplely inherited. It declares five virtual methods that can be overridden. Except for the on_error() method, any of these methods can set an error by calling G::Error::set(); in particular the G_MARKUP_ERROR_UNKNOWN_ELEMENT, G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, and G_MARKUP_ERROR_INVALID_CONTENT errors are intended to be set from these methods. If you set an error from a virtual method, G::MarkupParseContext::parse() will report that error back to its caller.


Member Function Documentation

virtual void Xfc::G::MarkupParser::on_start_element ( MarkupParseContext context,
const String element_name,
const std::map< const char *, const char * > &  attributes,
G::Error error 
) [protected, virtual]

Called when the opening tag of an element is seen.

Parameters:
context The MarkupParseContext.
element_name The element name.
attributes A map of attribute/value pairs.
error A reference to a G::Error to set if an error occurs.
The first value in the attribute map is the attribute name and the second value is the attribute value. You can retrieve the name and value of an attribute by doing something like this:
< std::map<const char*, const char*>::const_iterator i = attributes.begin();
< while (i != attributes.end())
< {
<       g_print("The name is %s and the value is %s\n", (*i).first, (*i).second);
<       ++i;
< }
<

Called for open tags .

virtual void Xfc::G::MarkupParser::on_end_element ( MarkupParseContext context,
const String element_name,
G::Error error 
) [protected, virtual]

Called when the closing tag of an element is seen.

Parameters:
context The MarkupParseContext.
element_name The element name.
error A reference to a G::Error to set if an error occurs.
Called for close tags .

virtual void Xfc::G::MarkupParser::on_text ( MarkupParseContext context,
const String  text,
G::Error error 
) [protected, virtual]

Called when some text is seen (text is always inside an element).

Parameters:
context The MarkupParseContext.
text The parsed text.
error A reference to a G::Error to set if an error occurs.
Called for character data.

virtual void Xfc::G::MarkupParser::on_passthrough ( MarkupParseContext context,
const String passthrough_text,
G::Error error 
) [protected, virtual]

Called 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.

Parameters:
context The MarkupParseContext.
passthrough_text The passthrough text.
error A reference to a G::Error to set if an error occurs.
Called for strings that should be re-saved verbatim in the same position, but are not otherwise interpretable. At the moment this includes comments and processing instructions.

virtual void Xfc::G::MarkupParser::on_error ( MarkupParseContext context,
G::Error error 
) [protected, virtual]

Called when an error occurs.

Parameters:
context The MarkupParseContext.
error A reference to a G::Error to set if an error occurs.
Called on error, including ones set by the other virtual methods.


The documentation for this class was generated from the following file: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3