44 #include "EST_error.h"
45 #include "EST_cutils.h"
46 #include "EST_cmd_line.h"
47 #include "EST_cmd_line_options.h"
48 #include "rxp/XML_Parser.h"
92 const char *instruction);
135 int main(
int argc,
char *argv[])
137 My_Parser_Class pclass;
146 "Summary: parse xml and output a tree.\n"
147 "use \"-\" to make input file stdin\n"
148 "-sysdir <string> Look for unqualified system entities in this directory"
152 switch (files.length())
154 case 0: filename=
"-";
156 case 1: filename=files.
first();
159 EST_error(
"Expected only one filename");
164 pclass.register_id(
"^\\([^/]*\\)",
165 al.
sval(
"-sysdir") +
"/\\1");
167 pclass.register_id(
"//CSTR//EST \\(.*\\)",
172 XML_Parser *parser = pclass.make_parser(filename,
184 for(them.
begin(attributes); them ; them++)
186 (
const char *)them->k,
187 (
const char *)them->v);
198 (void)print_attributes;
199 Parse_State *state = (Parse_State *)data;
203 printf(
"%*s document %d\n", state->depth*4,
">", state->depth);
211 Parse_State *state = (Parse_State *)data;
213 printf(
"%*s <document %d\n", state->depth*4,
">", state->depth);
223 (void)c; (void)p; (void)attributes;
224 Parse_State *state = (Parse_State *)data;
228 printf(
"%*s %s %d", state->depth*4,
">", name, state->depth);
229 print_attributes(attributes);
240 (void)c; (void)p; (void)attributes;
241 Parse_State *state = (Parse_State *)data;
243 printf(
"%*s %s %d", state->depth*4,
":", name, state->depth);
244 print_attributes(attributes);
255 Parse_State *state = (Parse_State *)data;
257 printf(
"%*s %s %d\n", state->depth*4,
"<", name, state->depth);
268 Parse_State *state = (Parse_State *)data;
270 printf(
"%*s [pcdata[%s]] %d\n", state->depth*4,
"", chars, state->depth);
280 Parse_State *state = (Parse_State *)data;
282 printf(
"%*s [cdata[%s]] %d\n", state->depth*4,
"", chars, state->depth);
289 const char *instruction)
292 Parse_State *state = (Parse_State *)data;
294 printf(
"%*s [proc[%s]] %d\n", state->depth*4,
"", instruction, state->depth);
303 Parse_State *state = (Parse_State *)data;
305 printf(
"%*s [error[%s]] %d\n", state->depth*4,
"", get_error(p), state->depth);