#include "xml/from-txt.h"
#include "xml/pathnode.h"
#include "xml/listnode.h"
#include "xml/dumpnode.h"
#include "xml/gerror.h"
#include <string.h>

#define ___ {
#define ____ }

int
main (int argc, char** argv)
{
    xml_g_set_prgname(argv[0]); 

    if (argc < 4)
    
{
	g_printerr ("> %s filename xpath insidetest [options]\n"
		    "\t print the path that would match the insidetest\n"
		    "\t when started from the node under the given xpath\n"
		    "\t spec (abbreviated form)\n",
		    g_get_prgname());
	return 1;
    }
___ gchar *filename = 0; const gchar *xpath = 0, *inside = 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 (! inside)
{ inside = argv[i]; continue; }
g_warning ("extra argument on commandline, ignored: %s", argv[i]); }
}
___ xml_GNode* tree; GError* error = 0; tree = xml_g_markup_parse_file (0, filename, &error); if (error) xml_g_show_error (&error, "after parsing file:\n\t'%s'", filename); ___ xml_GNode* node = xml_path_node (tree, xpath); if (! node) g_error ("node not found: '%s'\n", xpath); ___ xml_GNode* found = xml_tree_node_inside (tree, node, inside, 0); if (! found) g_error ("no match: '%s' not inside '%s'\n", inside, xpath); ___ int style = xml_path_CANON; if (strstr (styleflag, "-match")) style = xml_path_MATCH; if (strstr (styleflag, "-strict")) style = xml_path_STRICT; if (strstr (styleflag, "-canon")) style = xml_path_CANON; ___ gchar* path = xml_path_strdup (tree, found, style); if (path)
{
	g_print (path); g_print ("\n");
	g_free (path);
    }
return 0; ____;____;____;____;____;____; }
/* 
   Local variables:
   c-file-style: "stroustrup"
   End:
 */