/***************************************
 An automatically generated skeleton XML parser.

 Automatically generated by xsd-to-xmlparser.
 ***************************************/


#include <stdio.h>

#include "xmlparse.h"


/* The XML tag processing function prototypes */

static int xmlDeclaration_function(const char *_tag_,int _type_,const char *version,const char *encoding);
static int RoutinoTaggingType_function(const char *_tag_,int _type_);
static int RelationType_function(const char *_tag_,int _type_);
static int WayType_function(const char *_tag_,int _type_);
static int NodeType_function(const char *_tag_,int _type_);
static int IfType_function(const char *_tag_,int _type_,const char *k,const char *v);
static int LogErrorType_function(const char *_tag_,int _type_,const char *k,const char *v);
static int OutputType_function(const char *_tag_,int _type_,const char *k,const char *v);
static int UnsetType_function(const char *_tag_,int _type_,const char *k);
static int SetType_function(const char *_tag_,int _type_,const char *k,const char *v);


/* The XML tag definitions */

/*+ The SetType type tag. +*/
static xmltag SetType_tag=
              {"set",
               2, {"k","v"},
               SetType_function,
               {NULL}};

/*+ The UnsetType type tag. +*/
static xmltag UnsetType_tag=
              {"unset",
               1, {"k"},
               UnsetType_function,
               {NULL}};

/*+ The OutputType type tag. +*/
static xmltag OutputType_tag=
              {"output",
               2, {"k","v"},
               OutputType_function,
               {NULL}};

/*+ The LogErrorType type tag. +*/
static xmltag LogErrorType_tag=
              {"logerror",
               2, {"k","v"},
               LogErrorType_function,
               {NULL}};

/*+ The IfType type tag. +*/
static xmltag IfType_tag=
              {"if",
               2, {"k","v"},
               IfType_function,
               {&SetType_tag,&UnsetType_tag,&OutputType_tag,&LogErrorType_tag,NULL}};

/*+ The NodeType type tag. +*/
static xmltag NodeType_tag=
              {"node",
               0, {NULL},
               NodeType_function,
               {&IfType_tag,NULL}};

/*+ The WayType type tag. +*/
static xmltag WayType_tag=
              {"way",
               0, {NULL},
               WayType_function,
               {&IfType_tag,NULL}};

/*+ The RelationType type tag. +*/
static xmltag RelationType_tag=
              {"relation",
               0, {NULL},
               RelationType_function,
               {&IfType_tag,NULL}};

/*+ The RoutinoTaggingType type tag. +*/
static xmltag RoutinoTaggingType_tag=
              {"routino-tagging",
               0, {NULL},
               RoutinoTaggingType_function,
               {&NodeType_tag,&WayType_tag,&RelationType_tag,NULL}};

/*+ The xmlDeclaration type tag. +*/
static xmltag xmlDeclaration_tag=
              {"xml",
               2, {"version","encoding"},
               xmlDeclaration_function,
               {NULL}};


/*+ The complete set of tags at the top level. +*/
static xmltag *xml_toplevel_tags[]={&xmlDeclaration_tag,&RoutinoTaggingType_tag,NULL};


/* The XML tag processing functions */


/*++++++++++++++++++++++++++++++++++++++
  The function that is called when the SetType XSD type is seen

  int SetType_function Returns 0 if no error occured or something else otherwise.

  const char *_tag_ Set to the name of the element tag that triggered this function call.

  int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.

  const char *k The contents of the 'k' attribute (or NULL if not defined).

  const char *v The contents of the 'v' attribute (or NULL if not defined).
  ++++++++++++++++++++++++++++++++++++++*/

static int SetType_function(const char *_tag_,int _type_,const char *k,const char *v)
{
 printf("<%s%s",(_type_==XMLPARSE_TAG_END)?"/":"",_tag_);
 if(k) printf(" k=\"%s\"",ParseXML_Encode_Safe_XML(k));
 if(v) printf(" v=\"%s\"",ParseXML_Encode_Safe_XML(v));
 printf("%s>\n",(_type_==(XMLPARSE_TAG_START|XMLPARSE_TAG_END))?" /":"");
 return(0);
}


/*++++++++++++++++++++++++++++++++++++++
  The function that is called when the UnsetType XSD type is seen

  int UnsetType_function Returns 0 if no error occured or something else otherwise.

  const char *_tag_ Set to the name of the element tag that triggered this function call.

  int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.

  const char *k The contents of the 'k' attribute (or NULL if not defined).
  ++++++++++++++++++++++++++++++++++++++*/

static int UnsetType_function(const char *_tag_,int _type_,const char *k)
{
 printf("<%s%s",(_type_==XMLPARSE_TAG_END)?"/":"",_tag_);
 if(k) printf(" k=\"%s\"",ParseXML_Encode_Safe_XML(k));
 printf("%s>\n",(_type_==(XMLPARSE_TAG_START|XMLPARSE_TAG_END))?" /":"");
 return(0);
}


/*++++++++++++++++++++++++++++++++++++++
  The function that is called when the OutputType XSD type is seen

  int OutputType_function Returns 0 if no error occured or something else otherwise.

  const char *_tag_ Set to the name of the element tag that triggered this function call.

  int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.

  const char *k The contents of the 'k' attribute (or NULL if not defined).

  const char *v The contents of the 'v' attribute (or NULL if not defined).
  ++++++++++++++++++++++++++++++++++++++*/

static int OutputType_function(const char *_tag_,int _type_,const char *k,const char *v)
{
 printf("<%s%s",(_type_==XMLPARSE_TAG_END)?"/":"",_tag_);
 if(k) printf(" k=\"%s\"",ParseXML_Encode_Safe_XML(k));
 if(v) printf(" v=\"%s\"",ParseXML_Encode_Safe_XML(v));
 printf("%s>\n",(_type_==(XMLPARSE_TAG_START|XMLPARSE_TAG_END))?" /":"");
 return(0);
}


/*++++++++++++++++++++++++++++++++++++++
  The function that is called when the LogErrorType XSD type is seen

  int LogErrorType_function Returns 0 if no error occured or something else otherwise.

  const char *_tag_ Set to the name of the element tag that triggered this function call.

  int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.

  const char *k The contents of the 'k' attribute (or NULL if not defined).

  const char *v The contents of the 'v' attribute (or NULL if not defined).
  ++++++++++++++++++++++++++++++++++++++*/

static int LogErrorType_function(const char *_tag_,int _type_,const char *k,const char *v)
{
 printf("<%s%s",(_type_==XMLPARSE_TAG_END)?"/":"",_tag_);
 if(k) printf(" k=\"%s\"",ParseXML_Encode_Safe_XML(k));
 if(v) printf(" v=\"%s\"",ParseXML_Encode_Safe_XML(v));
 printf("%s>\n",(_type_==(XMLPARSE_TAG_START|XMLPARSE_TAG_END))?" /":"");
 return(0);
}


/*++++++++++++++++++++++++++++++++++++++
  The function that is called when the IfType XSD type is seen

  int IfType_function Returns 0 if no error occured or something else otherwise.

  const char *_tag_ Set to the name of the element tag that triggered this function call.

  int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.

  const char *k The contents of the 'k' attribute (or NULL if not defined).

  const char *v The contents of the 'v' attribute (or NULL if not defined).
  ++++++++++++++++++++++++++++++++++++++*/

static int IfType_function(const char *_tag_,int _type_,const char *k,const char *v)
{
 printf("<%s%s",(_type_==XMLPARSE_TAG_END)?"/":"",_tag_);
 if(k) printf(" k=\"%s\"",ParseXML_Encode_Safe_XML(k));
 if(v) printf(" v=\"%s\"",ParseXML_Encode_Safe_XML(v));
 printf("%s>\n",(_type_==(XMLPARSE_TAG_START|XMLPARSE_TAG_END))?" /":"");
 return(0);
}


/*++++++++++++++++++++++++++++++++++++++
  The function that is called when the NodeType XSD type is seen

  int NodeType_function Returns 0 if no error occured or something else otherwise.

  const char *_tag_ Set to the name of the element tag that triggered this function call.

  int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
  ++++++++++++++++++++++++++++++++++++++*/

static int NodeType_function(const char *_tag_,int _type_)
{
 printf("<%s%s",(_type_==XMLPARSE_TAG_END)?"/":"",_tag_);
 printf("%s>\n",(_type_==(XMLPARSE_TAG_START|XMLPARSE_TAG_END))?" /":"");
 return(0);
}


/*++++++++++++++++++++++++++++++++++++++
  The function that is called when the WayType XSD type is seen

  int WayType_function Returns 0 if no error occured or something else otherwise.

  const char *_tag_ Set to the name of the element tag that triggered this function call.

  int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
  ++++++++++++++++++++++++++++++++++++++*/

static int WayType_function(const char *_tag_,int _type_)
{
 printf("<%s%s",(_type_==XMLPARSE_TAG_END)?"/":"",_tag_);
 printf("%s>\n",(_type_==(XMLPARSE_TAG_START|XMLPARSE_TAG_END))?" /":"");
 return(0);
}


/*++++++++++++++++++++++++++++++++++++++
  The function that is called when the RelationType XSD type is seen

  int RelationType_function Returns 0 if no error occured or something else otherwise.

  const char *_tag_ Set to the name of the element tag that triggered this function call.

  int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
  ++++++++++++++++++++++++++++++++++++++*/

static int RelationType_function(const char *_tag_,int _type_)
{
 printf("<%s%s",(_type_==XMLPARSE_TAG_END)?"/":"",_tag_);
 printf("%s>\n",(_type_==(XMLPARSE_TAG_START|XMLPARSE_TAG_END))?" /":"");
 return(0);
}


/*++++++++++++++++++++++++++++++++++++++
  The function that is called when the RoutinoTaggingType XSD type is seen

  int RoutinoTaggingType_function Returns 0 if no error occured or something else otherwise.

  const char *_tag_ Set to the name of the element tag that triggered this function call.

  int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.
  ++++++++++++++++++++++++++++++++++++++*/

static int RoutinoTaggingType_function(const char *_tag_,int _type_)
{
 printf("<%s%s",(_type_==XMLPARSE_TAG_END)?"/":"",_tag_);
 printf("%s>\n",(_type_==(XMLPARSE_TAG_START|XMLPARSE_TAG_END))?" /":"");
 return(0);
}


/*++++++++++++++++++++++++++++++++++++++
  The function that is called when the XML declaration is seen

  int xmlDeclaration_function Returns 0 if no error occured or something else otherwise.

  const char *_tag_ Set to the name of the element tag that triggered this function call.

  int _type_ Set to XMLPARSE_TAG_START at the start of a tag and/or XMLPARSE_TAG_END at the end of a tag.

  const char *version The contents of the 'version' attribute (or NULL if not defined).

  const char *encoding The contents of the 'encoding' attribute (or NULL if not defined).
  ++++++++++++++++++++++++++++++++++++++*/

static int xmlDeclaration_function(const char *_tag_,int _type_,const char *version,const char *encoding)
{
 printf("<?%s",_tag_);
 if(version) printf(" version=\"%s\"",ParseXML_Encode_Safe_XML(version));
 if(encoding) printf(" encoding=\"%s\"",ParseXML_Encode_Safe_XML(encoding));
 printf(" ?>\n");
 return(0);
}


/*++++++++++++++++++++++++++++++++++++++
  A skeleton XML parser.
  ++++++++++++++++++++++++++++++++++++++*/

int main(int argc,char **argv)
{
 if(ParseXML(stdin,xml_toplevel_tags,XMLPARSE_UNKNOWN_ATTR_WARN))
    return(1);
 else
    return(0);
}
