int
main (int argc, char** argv)
{
xml_g_set_prgname(argv[0]);
if (argc < 3)
{
g_printerr ("> %s filename xpath [attrib] [options]\n"
"\t the program reads an xml text to its internal format\n"
"\t and saves the text area matching the xpath spec to\n"
"\t a new attribute (default name = saved)",
g_get_prgname());
return 1;
} |
___ gchar *filename = 0;
const gchar *xpath = 0, *attrib = 0, *styleflag = "";
{ int i ; for (i=1; i < argc ; i++) {
if (argv[i][0] == '-') { styleflag = argv[i]; continue; } |
if (! filename) { filename = argv[i]; continue; } |
if (! xpath) { xpath = argv[i]; continue; } |
if (! attrib) { attrib = argv[i]; continue; } |
g_warning ("extra argument on commandline, ignored: %s", argv[i]);
} | } |
if (! attrib) attrib = "saved";
___ xml_GNode* node; GError* error = 0;
node = xml_g_parse_file (0, argv[1], &error);
if (error)
xml_g_show_error (&error, "after parsing file:\n\t'%s'", filename);
xml_path_pcre_text_to_attr (node, xpath, attrib, 0);
xml_tree_dump_to_xml_file (node, 0, 1|xml_tree_dump_to_xml_flags (styleflag));
return 0;
____;____;
} |
|