feisty meow concerns codebase 2.140
xml_parser.h
Go to the documentation of this file.
1#ifndef XML_PARSER_CLASS
2#define XML_PARSER_CLASS
3
4/*****************************************************************************\
5* *
6* Name : xml_parser *
7* Author : Chris Koeritz *
8* *
9*******************************************************************************
10* Copyright (c) 2007-$now By Author. This program is free software; you can *
11* redistribute it and/or modify it under the terms of the GNU General Public *
12* License as published by the Free Software Foundation; either version 2 of *
13* the License or (at your option) any later version. This is online at: *
14* http://www.fsf.org/copyleft/gpl.html *
15* Please send any updates to: fred@gruntose.com *
16\*****************************************************************************/
17
18#include <basis/contracts.h>
19
20// forward.
21#include <basis/astring.h>
23
24namespace textual {
25
27
29{
30public:
31 xml_parser(const basis::astring &to_parse);
32 virtual ~xml_parser();
33
34 DEFINE_CLASS_NAME("xml_parser");
35
37 enum outcomes {
38 OKAY = basis::common::OKAY
39//uhhh...
40 };
41
42 static const char *outcome_name(const basis::outcome &to_name);
44
45 void reset(const basis::astring &to_parse);
47
50
54 structures::string_table &attributes);
56
62 structures::string_table &attributes);
64
67
70
71private:
72 basis::astring *_xml_stream; // the stringful of xml information.
73
74};
75
76} //namespace.
77
78#endif
79
Provides a dynamically resizable ASCII character string.
Definition astring.h:35
Outcomes describe the state of completion for an operation.
Definition outcome.h:31
Provides a symbol_table that holds strings as the content.
Parses XML input and invokes a callback for the different syntactic pieces.
Definition xml_parser.h:29
virtual basis::outcome content_callback(basis::astring &content)
invoked when plain text content is found inside an opened tag.
DEFINE_CLASS_NAME("xml_parser")
virtual basis::outcome tag_open_callback(basis::astring &tag_name, structures::string_table &attributes)
an xml tag has been opened in the input stream.
void reset(const basis::astring &to_parse)
throws out any accumulated information and uses "to_parse" instead.
outcomes
the possible ways that operations here can complete.
Definition xml_parser.h:37
static const char * outcome_name(const basis::outcome &to_name)
reports the string version of "to_name".
virtual basis::outcome tag_close_callback(basis::astring &tag_name)
an xml tag was closed in the input stream.
basis::outcome parse()
starts the parsing process on the current string.
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.