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

  | XML_Parser_Class () Create an object representing the class of parsers.
  void | register_id (EST_Regex id_pattern, EST_String directory) Add a mapping from entity ID (SYSTEM or PUBLIC) to filename.
  void | registered_ids (EST_TList<EST_String> &list) Fill in the list with the known entity ID mappings
  | Creating a parser
  XML_Parser* | make_parser (InputSource source, void* data) Create a parser for the RXP InputSource
  XML_Parser* | make_parser (InputSource source, Entity initial_entity, void* data) Create a parser for the RXP InputSource
  XML_Parser* | make_parser (FILE* input, void* data) Create a parser for a stdio input stream
  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
  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

  static InputSource | open_entity (Entity ent, void* arg) Do any neccessary remappings and open a stream which reads the given entity
  | The callbacks.
  virtual void | document_open (XML_Parser_Class &c, XML_Parser &p, void* data) Called when starting a document
  virtual void | document_close (XML_Parser_Class &c, XML_Parser &p, void* data) Called at the end of a document
  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
  virtual void | element_close (XML_Parser_Class &c, XML_Parser &p, void* data, const char* name) Called when an element ends
  virtual void | element (XML_Parser_Class &c, XML_Parser &p, void* data, const char* name, XML_Attribute_List &attributes) Called for empty elements.
  virtual void | pcdata (XML_Parser_Class &c, XML_Parser &p, void* data, const char* chars) Called for parsed character data sequences
  virtual void | cdata (XML_Parser_Class &c, XML_Parser &p, void* data, const char* chars) Called for unparsed character data sequences
  virtual void | processing (XML_Parser_Class &c, XML_Parser &p, void* data, const char* instruction) Called for processing directives
  virtual void | error (XML_Parser_Class &c, XML_Parser &p, void* data) Called when there is an error in parsing
  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
  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

`static InputSource open_entity(Entity ent, void* arg)`
  Do any neccessary remappings and open a stream which reads the given entity

`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)`
    Called when starting a document

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

  `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

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

  `virtual 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(...).

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

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

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

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

`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

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

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

`void 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.

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

`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

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

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

  `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

`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

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