94 const char *instruction);
102 int main(
int argc,
char *argv[])
104 My_Parser_Class pclass;
113 "Summary: parse xml and output a tree.\n" 114 "use \"-\" to make input file stdin\n" 115 "-sysdir <string> Look for unqualified system entities in this directory" 121 case 0: filename=
"-";
123 case 1: filename=files.
first();
131 pclass.register_id(
"^\\([^/]*\\)",
132 al.
sval(
"-sysdir") +
"/\\1");
134 pclass.register_id(
"//CSTR//EST \\(.*\\)",
139 XML_Parser *parser = pclass.make_parser(filename,
151 for(them.
begin(attributes); them ; them++)
153 (
const char *)them->k,
154 (
const char *)them->v);
165 (void)print_attributes;
166 Parse_State *state = (Parse_State *)data;
170 printf(
"%*s document %d\n", state->depth*4,
">", state->depth);
178 Parse_State *state = (Parse_State *)data;
180 printf(
"%*s <document %d\n", state->depth*4,
">", state->depth);
190 (void)c; (void)p; (void)attributes;
191 Parse_State *state = (Parse_State *)data;
195 printf(
"%*s %s %d", state->depth*4,
">", name, state->depth);
196 print_attributes(attributes);
207 (void)c; (void)p; (void)attributes;
208 Parse_State *state = (Parse_State *)data;
210 printf(
"%*s %s %d", state->depth*4,
":", name, state->depth);
211 print_attributes(attributes);
222 Parse_State *state = (Parse_State *)data;
224 printf(
"%*s %s %d\n", state->depth*4,
"<", name, state->depth);
235 Parse_State *state = (Parse_State *)data;
237 printf(
"%*s [pcdata[%s]] %d\n", state->depth*4,
"", chars, state->depth);
247 Parse_State *state = (Parse_State *)data;
249 printf(
"%*s [cdata[%s]] %d\n", state->depth*4,
"", chars, state->depth);
256 const char *instruction)
259 Parse_State *state = (Parse_State *)data;
261 printf(
"%*s [proc[%s]] %d\n", state->depth*4,
"", instruction, state->depth);
270 Parse_State *state = (Parse_State *)data;
272 printf(
"%*s [error[%s]] %d\n", state->depth*4,
"", get_error(p), state->depth);
int main(int argc, char *argv[])
A specialised hash table for when the key is an EST_String.
EST_Track error(EST_Track &ref, EST_Track &test, int relax=0)
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)
const EST_String & sval(const EST_String &rkey, int m=1) const
const T & first() const
return const reference to first item in list
void begin(const Container &over)
Set the iterator ready to run over this container.
int present(const K &rkey) const
Returns true if key is present.
int parse_command_line(int argc, char *argv[], const EST_String &usage, EST_StrList &files, EST_Option &al, int make_stdio=1)
const char *const est_libdir