In file ../include/rxp/XML_Parser.h:

class XML_Parser_Class

A Class of parsers, All parsers share callbacks and a list of known public IDs

Public Methods

[more] XML_Parser_Class ()
Create an object representing the class of parsers.
[more]void register_id (EST_Regex id_pattern, EST_String directory)
Add a mapping from entity ID (SYSTEM or PUBLIC) to filename.
[more]void registered_ids (EST_TList<EST_String> &list)
Fill in the list with the known entity ID mappings
[more] Creating a parser

[more]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)
Create a parser for a stdio input stream, giving a description for use in errors

[more]InputSource try_and_open (Entity ent)
Utility which tries to open an entity called ID at places specified in the mapping of this parser class

Protected Methods

[more]static InputSource open_entity (Entity ent, void* arg)
Do any neccessary remappings and open a stream which reads the given entity
[more] The callbacks.

[more]virtual void document_open (XML_Parser_Class &c, XML_Parser &p, void* data)
Called when starting a document
[more]virtual void document_close (XML_Parser_Class &c, XML_Parser &p, void* data)
Called at the end of a document
[more]virtual void element_open (XML_Parser_Class &c, XML_Parser &p, void* data, const char* name, XML_Attribute_List &attributes)
Called when an element starts
[more]virtual void element_close (XML_Parser_Class &c, XML_Parser &p, void* data, const char* name)
Called when an element ends
[more]virtual void element (XML_Parser_Class &c, XML_Parser &p, void* data, const char* name, XML_Attribute_List &attributes)
Called for empty elements.
[more]virtual void pcdata (XML_Parser_Class &c, XML_Parser &p, void* data, const char* chars)
Called for parsed character data sequences
[more]virtual void cdata (XML_Parser_Class &c, XML_Parser &p, void* data, const char* chars)
Called for unparsed character data sequences
[more]virtual void processing (XML_Parser_Class &c, XML_Parser &p, void* data, const char* instruction)
Called for processing directives
[more]virtual void error (XML_Parser_Class &c, XML_Parser &p, void* data)
Called when there is an error in parsing

[more]void error (XML_Parser_Class &c, XML_Parser &p, void* data, EST_String message)
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
[more]const char* get_error (XML_Parser &p)
Get the error message for the last error


Documentation

A Class of parsers, All parsers share callbacks and a list of known public IDs
ostatic InputSource open_entity(Entity ent, void* arg)
Do any neccessary remappings and open a stream which reads the given entity

o The callbacks.
These methods can be overridden in a subclass to create a class of parsers to do whatever you want.

ovirtual void document_open(XML_Parser_Class &c, XML_Parser &p, void* data)
Called when starting a document

ovirtual void document_close(XML_Parser_Class &c, XML_Parser &p, void* data)
Called at the end of a document

ovirtual void element_open(XML_Parser_Class &c, XML_Parser &p, void* data, const char* name, XML_Attribute_List &attributes)
Called when an element starts

ovirtual void element_close(XML_Parser_Class &c, XML_Parser &p, void* data, const char* name)
Called when an element ends

ovirtual void element(XML_Parser_Class &c, XML_Parser &p, void* data, const char* name, XML_Attribute_List &attributes)
Called for empty elements.

Defaults to element_open(...) forllowed by element_closed(...).

ovirtual void pcdata(XML_Parser_Class &c, XML_Parser &p, void* data, const char* chars)
Called for parsed character data sequences

ovirtual void cdata(XML_Parser_Class &c, XML_Parser &p, void* data, const char* chars)
Called for unparsed character data sequences

ovirtual void processing(XML_Parser_Class &c, XML_Parser &p, void* data, const char* instruction)
Called for processing directives

ovirtual void error(XML_Parser_Class &c, XML_Parser &p, void* data)
Called when there is an error in parsing

ovoid error(XML_Parser_Class &c, XML_Parser &p, void* data, EST_String message)
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

oconst char* get_error(XML_Parser &p)
Get the error message for the last error

o XML_Parser_Class()
Create an object representing the class of parsers.

ovoid 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.

ovoid registered_ids(EST_TList<EST_String> &list)
Fill in the list with the known entity ID mappings

o Creating a parser
Each of these methods creates a one-shot parser which will run over the indicated text.

oXML_Parser* make_parser(InputSource source, void* data)
Create a parser for the RXP InputSource

oXML_Parser* make_parser(InputSource source, Entity initial_entity, void* data)
Create a parser for the RXP InputSource

oXML_Parser* make_parser(FILE* input, void* data)
Create a parser for a stdio input stream

oXML_Parser* 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

oInputSource try_and_open(Entity ent)
Utility which tries to open an entity called ID at places specified in the mapping of this parser class


This class has no child classes.
Friends:
class XML_Parser

Alphabetic index HTML hierarchy of classes or Java


This page is part of the Edinburgh Speech Tools Library documentation
Copyright University of Edinburgh 1997
Contact: speech_tools@cstr.ed.ac.uk