Orcus
Public Member Functions | List of all members
sax_parser_handler Class Reference

#include <sax.hpp>

Public Member Functions

void doctype (const orcus::sax::doctype_declaration &param)
 
void start_declaration (const orcus::pstring &decl)
 
void end_declaration (const orcus::pstring &decl)
 
void start_element (const orcus::sax::parser_element &elem)
 
void end_element (const orcus::sax::parser_element &elem)
 
void characters (const orcus::pstring &val, bool transient)
 
void attribute (const orcus::pstring &name, const orcus::pstring &val)
 
void attribute (const orcus::sax::parser_attribute &attr)
 

Detailed Description

Skeleton handler for sax_parser. Feel free to copy this as a starting point for your own handler.

Member Function Documentation

void sax_parser_handler::attribute ( const orcus::pstring name,
const orcus::pstring val 
)
inline

Called upon parsing of a name-value pair within <? ... ?> tag.

Parameters
nameattribute name.
valattribute value text.
void sax_parser_handler::attribute ( const orcus::sax::parser_attribute attr)
inline

Called upon parsing of an attribute of an element. Note that when the attribute's transient flag is set, the attribute value is stored in a temporary buffer due to presence of one or more encoded characters, and must be processed within the scope of the callback.

Parameters
attrstruct containing attribute information.
void sax_parser_handler::characters ( const orcus::pstring val,
bool  transient 
)
inline

Called when a segment of a text content is parsed. Each text content is a direct child of an element, which may have multiple child contents when the element also has a child element that are direct sibling to the text contents or the text contents are splitted by a comment.

Parameters
valvalue of the text content.
transientwhen true, the text content has been converted and is stored in a temporary buffer due to presence of one or more encoded characters, in which case the passed text value needs to be either immediately converted to a non-text value or be interned within the scope of the callback.
void sax_parser_handler::doctype ( const orcus::sax::doctype_declaration param)
inline

Called when a doctype declaration <!DOCTYPE ... > is encountered.

Parameters
paramstruct containing doctype declaration data.
void sax_parser_handler::end_declaration ( const orcus::pstring decl)
inline

Called when the closing tag (>) of a <?... ?> is encountered.

Parameters
declname of the identifier.
void sax_parser_handler::end_element ( const orcus::sax::parser_element elem)
inline

Called at the end of each element.

Parameters
eleminformation of the element being parsed.
void sax_parser_handler::start_declaration ( const orcus::pstring decl)
inline

Called when <?... is encountered, where the '...' may be an arbitraray dentifier. One common declaration is <?xml which is typically given at the start of an XML stream.

Parameters
declname of the identifier.
void sax_parser_handler::start_element ( const orcus::sax::parser_element elem)
inline

Called at the start of each element.

Parameters
eleminformation of the element being parsed.