sax_ns_handler
Defined in header: <orcus/sax_ns_parser.hpp>
-
class sax_ns_handler
Subclassed by orcus::sax_token_handler_wrapper_base
Public Functions
-
inline void doctype(const orcus::sax::doctype_declaration &dtd)
Called when a doctype declaration <!DOCTYPE … > is encountered.
- Parameters:
dtd – struct containing doctype declaration data.
-
inline void start_declaration()
Called when the XML declaration <?xml … ?> is encountered. Only fires for the XML declaration; processing instructions (any other <?target … ?>) are reported through start_processing_instruction.
-
inline void end_declaration()
Called when the closing tag (?>) of the XML declaration is encountered.
-
inline void start_processing_instruction(std::string_view target)
Called when a processing instruction <?target … is encountered, where ‘target’ is any identifier other than ‘xml’.
- Parameters:
target – target name of the processing instruction.
-
inline void end_processing_instruction(std::string_view target)
Called when the closing tag (?>) of a processing instruction is encountered.
- Parameters:
target – target name of the processing instruction.
-
inline void start_element(const orcus::sax_ns_parser_element &elem)
Called at the start of each element.
- Parameters:
elem – information of the element being parsed.
-
inline void end_element(const orcus::sax_ns_parser_element &elem)
Called at the end of each element.
- Parameters:
elem – information of the element being parsed.
-
inline void characters(std::string_view val, bool transient)
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:
val – value of the text content.
transient – when 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.
-
inline void attribute(std::string_view name, std::string_view val)
Called upon parsing of an attribute of the XML declaration or a processing instruction. The value of an attribute is assumed to be transient thus should be consumed within the scope of this callback.
- Todo:
Perhaps we should pass the transient flag here as well like all the other places.
- Parameters:
name – name of an attribute.
val – value of an attribute.
-
inline void attribute(const orcus::sax_ns_parser_attribute &attr)
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:
attr – struct containing attribute information.
-
inline void namespace_declaration(std::string_view alias, xmlns_id_t ns_id)
Called upon encountering a namespace declaration - either a default namespace declaration or one with an alias.
- Parameters:
alias – Namespace alias, or an empty value for a default namespace.
ns_id – Namespace Name.
-
inline void comment(std::string_view val)
Called when a comment <!— … —> is encountered. The text between the comment delimiters is passed verbatim, with no whitespace trimming or entity decoding.
- Parameters:
val – Text content of the comment.
-
inline void doctype(const orcus::sax::doctype_declaration &dtd)