Loading...
Searching...
No Matches
XML_Parser_Class Class Reference

`#include <include/rxp/XML_Parser.h>`

Inheritance diagram for XML_Parser_Class:
[legend]

## Static Protected Member Functions

static InputSource | open_entity (Entity ent, void *arg)

## Creating a parser

Each of these methods creates a one-shot parser which will run over the indicated text.
class | XML_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)
XML_Parser * | make_parser (const EST_String filename, void *data)
InputSource | try_and_open (Entity ent)

## 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)
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.
| XML_Parser_Class ()
void | register_id (EST_Regex id_pattern, EST_String directory)
void | registered_ids (EST_TList< EST_String > &list)

## Detailed Description

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

Definition at line 78 of file XML_Parser.h.

## Constructor & Destructor Documentation

## XML_Parser_Class()

XML_Parser_Class::XML_Parser_Class | ( |  | ) |

Create an object representing the class of parsers.

Definition at line 44 of file XML_Parser.cc.

## ~XML_Parser_Class()

virtual XML_Parser_Class::~XML_Parser_Class | ( |  | ) |

inline virtual

Definition at line 182 of file XML_Parser.h.

## Member Function Documentation

## open_entity()

InputSource XML_Parser_Class::open_entity | ( | Entity | ent,
|  | void * | arg )

static protected

Do any necessary remappings and open a stream which reads the given entity.

Definition at line 160 of file XML_Parser.cc.

## document_open()

void XML_Parser_Class::document_open | ( | XML_Parser_Class & | c,
|  | XML_Parser & | p,
|  | void * | data )

protected virtual

Called when starting a document.

Definition at line 169 of file XML_Parser.cc.

## document_close()

void XML_Parser_Class::document_close | ( | XML_Parser_Class & | c,
|  | XML_Parser & | p,
|  | void * | data )

protected virtual

Called at the end of a document.

Definition at line 174 of file XML_Parser.cc.

## element_open()

void XML_Parser_Class::element_open | ( | XML_Parser_Class & | c,
|  | XML_Parser & | p,
|  | void * | data,
|  | const char * | name,
|  | XML_Attribute_List & | attributes )

protected virtual

Called when an element starts.

Definition at line 179 of file XML_Parser.cc.

## element_close()

void XML_Parser_Class::element_close | ( | XML_Parser_Class & | c,
|  | XML_Parser & | p,
|  | void * | data,
|  | const char * | name )

protected virtual

Called when an element ends.

Definition at line 196 of file XML_Parser.cc.

## element()

void XML_Parser_Class::element | ( | XML_Parser_Class & | c,
|  | XML_Parser & | p,
|  | void * | data,
|  | const char * | name,
|  | XML_Attribute_List & | attributes )

protected virtual

Called for empty elements.

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

Definition at line 186 of file XML_Parser.cc.

## pcdata()

void XML_Parser_Class::pcdata | ( | XML_Parser_Class & | c,
|  | XML_Parser & | p,
|  | void * | data,
|  | const char * | chars )

protected virtual

Called for parsed character data sequences.

Definition at line 202 of file XML_Parser.cc.

## cdata()

void XML_Parser_Class::cdata | ( | XML_Parser_Class & | c,
|  | XML_Parser & | p,
|  | void * | data,
|  | const char * | chars )

protected virtual

Called for unparsed character data sequences.

Definition at line 208 of file XML_Parser.cc.

## processing()

void XML_Parser_Class::processing | ( | XML_Parser_Class & | c,
|  | XML_Parser & | p,
|  | void * | data,
|  | const char * | instruction )

protected virtual

Called for processing directives.

Definition at line 214 of file XML_Parser.cc.

## error() [1/2]

void XML_Parser_Class::error | ( | XML_Parser_Class & | c,
|  | XML_Parser & | p,
|  | void * | data )

protected virtual

Called when there is an error in parsing.

Definition at line 220 of file XML_Parser.cc.

## error() [2/2]

void XML_Parser_Class::error | ( | XML_Parser_Class & | c,
|  | XML_Parser & | p,
|  | void * | data,
|  | EST_String | message )

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 230 of file XML_Parser.cc.

## get_error()

const char * XML_Parser_Class::get_error | ( | XML_Parser & | p | ) |

protected

Get the error message for the last error.

Definition at line 225 of file XML_Parser.cc.

## register_id()

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.

## registered_ids()

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.

## make_parser() [1/5]

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.

## make_parser() [2/5]

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.

## make_parser() [3/5]

XML_Parser * XML_Parser_Class::make_parser | ( | FILE * | input,
|  | void * | data )

Create a parser for a stdio input stream.

Definition at line 95 of file XML_Parser.cc.

## make_parser() [4/5]

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.

## make_parser() [5/5]

XML_Parser * XML_Parser_Class::make_parser | ( | const EST_String | filename,
|  | void * | data )

Definition at line 102 of file XML_Parser.cc.

## try_and_open()

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 125 of file XML_Parser.cc.

## Friends And Related Symbol Documentation

## XML_Parser

friend class XML_Parser

friend

XML_Parser defines the behaviour of an individual one-shot parser.

Definition at line 231 of file XML_Parser.h.

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

- include/rxp/XML_Parser.h
- rxp/XML_Parser.cc