feisty meow concerns codebase  2.140
textual::xml_parser Class Reference

Parses XML input and invokes a callback for the different syntactic pieces. More...

#include <xml_parser.h>

Public Types

enum  outcomes { OKAY = basis::common::OKAY }
 the possible ways that operations here can complete. More...
 

Public Member Functions

 xml_parser (const basis::astring &to_parse)
 
virtual ~xml_parser ()
 
 DEFINE_CLASS_NAME ("xml_parser")
 
void reset (const basis::astring &to_parse)
 throws out any accumulated information and uses "to_parse" instead. More...
 
basis::outcome parse ()
 starts the parsing process on the current string. More...
 
virtual basis::outcome header_callback (basis::astring &header_name, structures::string_table &attributes)
 invoked when a well-formed xml header is seen in the input stream. More...
 
virtual basis::outcome tag_open_callback (basis::astring &tag_name, structures::string_table &attributes)
 an xml tag has been opened in the input stream. More...
 
virtual basis::outcome tag_close_callback (basis::astring &tag_name)
 an xml tag was closed in the input stream. More...
 
virtual basis::outcome content_callback (basis::astring &content)
 invoked when plain text content is found inside an opened tag. More...
 

Static Public Member Functions

static const char * outcome_name (const basis::outcome &to_name)
 reports the string version of "to_name". More...
 

Detailed Description

Parses XML input and invokes a callback for the different syntactic pieces.

Definition at line 28 of file xml_parser.h.

Member Enumeration Documentation

◆ outcomes

the possible ways that operations here can complete.

Enumerator
OKAY 

Definition at line 37 of file xml_parser.h.

Constructor & Destructor Documentation

◆ xml_parser()

textual::xml_parser::xml_parser ( const basis::astring to_parse)

Definition at line 25 of file xml_parser.cpp.

◆ ~xml_parser()

textual::xml_parser::~xml_parser ( )
virtual

Definition at line 31 of file xml_parser.cpp.

Member Function Documentation

◆ content_callback()

outcome textual::xml_parser::content_callback ( basis::astring content)
virtual

invoked when plain text content is found inside an opened tag.

Definition at line 66 of file xml_parser.cpp.

◆ DEFINE_CLASS_NAME()

textual::xml_parser::DEFINE_CLASS_NAME ( "xml_parser"  )

◆ header_callback()

outcome textual::xml_parser::header_callback ( basis::astring header_name,
structures::string_table attributes 
)
virtual

invoked when a well-formed xml header is seen in the input stream.

the following applies to all of the callbacks: the derived method must return an outcome, which will be used by the parser. if the outcome is OKAY, then parsing will continue. any other outcome will cause parsing to stop and will become the return value of the parse() method.

Definition at line 45 of file xml_parser.cpp.

References structures::symbol_table< contents >::symbols().

◆ outcome_name()

const char * textual::xml_parser::outcome_name ( const basis::outcome to_name)
static

reports the string version of "to_name".

Definition at line 35 of file xml_parser.cpp.

References basis::common::outcome_name().

◆ parse()

outcome textual::xml_parser::parse ( )

starts the parsing process on the current string.

this will cause callbacks to be invoked for each of the xml syntactic elements.

Definition at line 72 of file xml_parser.cpp.

◆ reset()

void textual::xml_parser::reset ( const basis::astring to_parse)

throws out any accumulated information and uses "to_parse" instead.

Definition at line 40 of file xml_parser.cpp.

◆ tag_close_callback()

outcome textual::xml_parser::tag_close_callback ( basis::astring tag_name)
virtual

an xml tag was closed in the input stream.

Definition at line 60 of file xml_parser.cpp.

◆ tag_open_callback()

outcome textual::xml_parser::tag_open_callback ( basis::astring tag_name,
structures::string_table attributes 
)
virtual

an xml tag has been opened in the input stream.

Definition at line 53 of file xml_parser.cpp.

References structures::symbol_table< contents >::symbols().


The documentation for this class was generated from the following files: