Orcus
Loading...
Searching...
No Matches
orcus::sax_ns_handler Class Reference

Public Member Functions

void doctype (const orcus::sax::doctype_declaration &dtd)
void start_declaration (std::string_view decl)
void end_declaration (std::string_view decl)
void start_element (const orcus::sax_ns_parser_element &elem)
void end_element (const orcus::sax_ns_parser_element &elem)
void characters (std::string_view val, bool transient)
void attribute (std::string_view name, std::string_view val)
void attribute (const orcus::sax_ns_parser_attribute &attr)

Member Function Documentation

◆ attribute() [1/2]

void orcus::sax_ns_handler::attribute ( const orcus::sax_ns_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 a presence of encoded characters, and must be processed within the scope of the callback.

Parameters
attrstruct containing attribute information.

◆ attribute() [2/2]

void orcus::sax_ns_handler::attribute ( std::string_view name,
std::string_view val )
inline

Called upon parsing of an attribute of a declaration. The value of an attribute is assumed to be transient thus should be consumed within the scope of this callback.

Parameters
namename of an attribute.
valvalue of an attribute.
Todo
Perhaps we should pass the transient flag here as well like all the other places.

◆ characters()

void orcus::sax_ns_handler::characters ( std::string_view 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.

◆ doctype()

void orcus::sax_ns_handler::doctype ( const orcus::sax::doctype_declaration & dtd)
inline

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

Parameters
dtdstruct containing doctype declaration data.

◆ end_declaration()

void orcus::sax_ns_handler::end_declaration ( std::string_view decl)
inline

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

Parameters
declname of the identifier.

◆ end_element()

void orcus::sax_ns_handler::end_element ( const orcus::sax_ns_parser_element & elem)
inline

Called at the end of each element.

Parameters
eleminformation of the element being parsed.

◆ start_declaration()

void orcus::sax_ns_handler::start_declaration ( std::string_view 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.

◆ start_element()

void orcus::sax_ns_handler::start_element ( const orcus::sax_ns_parser_element & elem)
inline

Called at the start of each element.

Parameters
eleminformation of the element being parsed.