50 known_ids.
add_item(id_pattern, directory);
57 for(p=known_ids.
head(); p != 0; p= p->
next())
69 return new XML_Parser(*
this, source, ent, data);
107 if ( filename ==
"-" )
110 FILE *input = fopen(filename,
"r");
120 EST_sys_error(
"Can't open 16 bit '%s'", (
const char *)filename);
133 EST_String id = ent->publicid?ent->publicid:ent->systemid;
138 for (p = known_ids.
head(); p != 0; p = p->
next())
143 if (
id.matches(re, 0, starts, ends))
146 res.
subst(
id, starts, ends);
150 if((f = fopen(res,
"r")))
169 return parser->
open(ent);
177 { (void)c; (void)p; (void)data; }
182 { (void)c; (void)p; (void)data; }
189 { (void)c; (void)p; (void)data; (void)name; (void)attributes; }
196 { (void)c; (void)p; (void)data; (void)name; (void)attributes;
205 { (void)c; (void)p; (void)data; (void)name; }
211 { (void)c; (void)p; (void)data; (void)chars; }
217 { (void)c; (void)p; (void)data; (void)chars; }
222 const char *instruction)
223 { (void)c; (void)p; (void)data; (void)instruction; }
228 { (void)c; (void)p; (void)data; }
257 p_track_contents = 0;
279 return pclass->try_and_open(ent);
291 pclass->document_open(*pclass, *
this, data);
304 for (b=bit->attributes; b; b=b->next)
311 pclass->element_open(*pclass,
314 bit->element_definition->name,
325 pclass->element(*pclass,
328 bit->element_definition->name,
337 pclass->element_close(*pclass,
340 bit->element_definition->name
345 pclass->pcdata(*pclass,
353 pclass->cdata(*pclass,
361 pclass->processing(*pclass,
369 pclass->error(*pclass,
382 if (current_bit!=
NULL)
388 pclass->document_close(*pclass, *
this, data);
393 p_track_context=flag;
398 p_track_contents=flag;
405 int linenum, charnum;
407 XBit bit = current_bit;
410 return "No Parse In Progress";
414 bit->type ==
XBIT_error ?
"Error" :
"Warning",
416 bit->error_message?bit->error_message:
"non XML error" 419 for(s=p->source; s; s=s->parent)
423 p_error_message +=
" in entity \"";
424 p_error_message += s->entity->name;
425 p_error_message +=
"\"";
428 p_error_message +=
" in unnamed entity";
447 p_error_message +=
" defined in ";
452 p_error_message +=
"\n";
455 return (
const char *)p_error_message;
460 return p_context.nth(n);
XBit current_bit
The piece of markup being processed.
void track_contents(bool flag)
const K & key(EST_Litem *ptr, int m=1) const
find key, reference by ptr
int subst(EST_String source, size_t(&starts)[EST_Regex_max_subexpressions], size_t(&ends)[EST_Regex_max_subexpressions])
Substitute the result of a match into a string.
XML_API void FreeDtd(Dtd dtd)
XML_API void FreeEntity(Entity e)
static EST_String Number(int i, int base=10)
Build string from an integer.
virtual void element_close(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name)
STD_API FILE16 * MakeFILE16FromFILE(FILE *f, const char *type)
virtual void pcdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars)
virtual void document_close(XML_Parser_Class &c, XML_Parser &p, void *data)
STD_API void SetCloseUnderlying(FILE16 *file, int cu)
virtual void element_open(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes)
A Regular expression class to go with the CSTR EST_String class.
#define EST_Regex_max_subexpressions
void registered_ids(EST_TList< EST_String > &list)
const char * get_error(XML_Parser &p)
Get the error message for the last error.
A specialised hash table for when the key is an EST_String.
~XML_Parser()
Destructor, may close input if required.
XML_API const char8 * EntityDescription(Entity e)
#define NewExternalEntity(name, pub, sys, nnot, parent)
void register_id(EST_Regex id_pattern, EST_String directory)
static EST_String cat(const EST_String s1, const EST_String s2=Empty, const EST_String s3=Empty, const EST_String s4=Empty, const EST_String s5=Empty, const EST_String s6=Empty, const EST_String s7=Empty, const EST_String s8=Empty, const EST_String s9=Empty)
InputSource try_and_open(Entity ent)
XML_API int ParserPush(Parser p, InputSource source)
static InputSource open_entity(Entity ent, void *arg)
XML_Parser(XML_Parser_Class &parent, InputSource source, Entity initial_entity, void *data)
Creator used by XML_Parser_Class::make_parser()
virtual void element(XML_Parser_Class &c, XML_Parser &p, void *data, const char *name, XML_Attribute_List &attributes)
void track_context(bool flag)
XML_API Parser NewParser(void)
const char * get_error()
Get the error message for the last error.
XML_API void ParserSetFlag(Parser p, ParserFlag flag, int value)
EST_Litem * head() const
Return First key value pair in list.
virtual void cdata(XML_Parser_Class &c, XML_Parser &p, void *data, const char *chars)
XML_API void FreeParser(Parser p)
const V & val(const K &rkey, bool m=0) const
return value according to key (const)
EST_String context(int n)
void append(const T &item)
add item onto end of list
int add_item(const K &key, const V &value, int no_search=0)
Add an entry to the table.
InputSource open(Entity ent)
Open. Asks the parser class to do the work.
XML_Parser * make_parser(InputSource source, void *data)
Create a parser for the RXP InputSource.
int add_item(const K &rkey, const V &rval, int no_search=0)
add key-val pair to list
XML_API void ParserSetCallbackArg(Parser p, void *arg)
virtual void error(XML_Parser_Class &c, XML_Parser &p, void *data)
virtual void processing(XML_Parser_Class &c, XML_Parser &p, void *data, const char *instruction)
STD_API char8 * strdup8(const char8 *s)
XML_API XBit ReadXBit(Parser p)
EST_String tostring(void) const
Get the expression as a string.
virtual void document_open(XML_Parser_Class &c, XML_Parser &p, void *data)
XML_API void ParserSetEntityOpener(Parser p, EntityOpenerProc opener)
XML_API void FreeXBit(XBit xbit)