#include <include/rxp/XML_Parser.h>
Public Member Functions | |
XML_Parser_Class () | |
virtual | ~XML_Parser_Class () |
void | register_id (EST_Regex id_pattern, EST_String directory) |
void | registered_ids (EST_TList< EST_String > &list) |
InputSource | try_and_open (Entity ent) |
Creating a parser | |
Each of these methods creates a one-shot parser which will run over the indicated text. | |
XML_Parser * | make_parser (InputSource source, void *data) |
Create a parser for the RXP InputSource. More... | |
XML_Parser * | make_parser (InputSource source, Entity initial_entity, void *data) |
Create a parser for the RXP InputSource. More... | |
XML_Parser * | make_parser (FILE *input, void *data) |
Create a parser for a stdio input stream. More... | |
XML_Parser * | make_parser (FILE *input, const EST_String desc, void *data) |
XML_Parser * | make_parser (const EST_String filename, void *data) |
Protected Member Functions | |
void | error (XML_Parser_Class &c, XML_Parser &p, void *data, EST_String message) |
const char * | get_error (XML_Parser &p) |
Get the error message for the last error. More... | |
The callbacks. | |
These methods can be overridden in a subclass to create a class of parsers to do whatever you want. | |
virtual void | document_open (XML_Parser_Class &c, XML_Parser &p, void *data) |
virtual void | document_close (XML_Parser_Class &c, XML_Parser &p, void *data) |
virtual void | element_open (XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes) |
virtual void | element_close (XML_Parser_Class &c, XML_Parser &p, void *data, const char *name) |
virtual void | element (XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes) |
virtual void | pcdata (XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars) |
virtual void | cdata (XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars) |
virtual void | processing (XML_Parser_Class &c, XML_Parser &p, void *data, const char *instruction) |
virtual void | error (XML_Parser_Class &c, XML_Parser &p, void *data) |
Static Protected Member Functions | |
static InputSource | open_entity (Entity ent, void *arg) |
Friends | |
class | XML_Parser |
A Class of parsers, All parsers share callbacks and a list of known public IDs.
Definition at line 78 of file XML_Parser.h.
XML_Parser_Class::XML_Parser_Class | ( | ) |
Create an object representing the class of parsers.
Definition at line 44 of file XML_Parser.cc.
|
inlinevirtual |
Definition at line 182 of file XML_Parser.h.
|
staticprotected |
Do any necessary remappings and open a stream which reads the given entity.
Definition at line 165 of file XML_Parser.cc.
|
protectedvirtual |
Called when starting a document.
Definition at line 174 of file XML_Parser.cc.
|
protectedvirtual |
Called at the end of a document.
Definition at line 179 of file XML_Parser.cc.
|
protectedvirtual |
Called when an element starts.
Definition at line 184 of file XML_Parser.cc.
|
protectedvirtual |
Called when an element ends.
Definition at line 201 of file XML_Parser.cc.
|
protectedvirtual |
Called for empty elements.
Defaults to element_open(...) followed by element_closed(...).
Definition at line 191 of file XML_Parser.cc.
|
protectedvirtual |
Called for parsed character data sequences.
Definition at line 207 of file XML_Parser.cc.
|
protectedvirtual |
Called for unparsed character data sequences.
Definition at line 213 of file XML_Parser.cc.
|
protectedvirtual |
Called for processing directives.
Definition at line 219 of file XML_Parser.cc.
|
protectedvirtual |
Called when there is an error in parsing.
Definition at line 225 of file XML_Parser.cc.
|
protected |
This can be called from any of the callbacks to present "message" as an error through the error callback, thus getting filename and line information into the message.
Definition at line 235 of file XML_Parser.cc.
|
protected |
Get the error message for the last error.
Definition at line 230 of file XML_Parser.cc.
void XML_Parser_Class::register_id | ( | EST_Regex | id_pattern, |
EST_String | directory | ||
) |
Add a mapping from entity ID (SYSTEM or PUBLIC) to filename.
The string can contain escapes like \2 which are replaced by the text matching the Nth bracketed part of the regular expression.
Definition at line 48 of file XML_Parser.cc.
void XML_Parser_Class::registered_ids | ( | EST_TList< EST_String > & | list | ) |
Fill in the list with the known entity ID mappings.
Definition at line 53 of file XML_Parser.cc.
XML_Parser * XML_Parser_Class::make_parser | ( | InputSource | source, |
void * | data | ||
) |
Create a parser for the RXP InputSource.
Definition at line 72 of file XML_Parser.cc.
XML_Parser * XML_Parser_Class::make_parser | ( | InputSource | source, |
Entity | initial_entity, | ||
void * | data | ||
) |
Create a parser for the RXP InputSource.
Definition at line 67 of file XML_Parser.cc.
XML_Parser * XML_Parser_Class::make_parser | ( | FILE * | input, |
void * | data | ||
) |
Create a parser for a stdio input stream.
Definition at line 97 of file XML_Parser.cc.
XML_Parser * XML_Parser_Class::make_parser | ( | FILE * | input, |
const EST_String | desc, | ||
void * | data | ||
) |
Create a parser for a stdio input stream, giving a description for use in errors.
Definition at line 78 of file XML_Parser.cc.
XML_Parser * XML_Parser_Class::make_parser | ( | const EST_String | filename, |
void * | data | ||
) |
Definition at line 104 of file XML_Parser.cc.
InputSource XML_Parser_Class::try_and_open | ( | Entity | ent | ) |
Utility which tries to open an entity called ID at places specified in the mapping of this parser class.
Definition at line 130 of file XML_Parser.cc.
|
friend |
XML_Parser defines the behaviour of an individual one-shot parser.
Definition at line 231 of file XML_Parser.h.