This page is for MicroXML code

MicroXML is very small (~500 lines of c code) XML parser. I wrote it some years ago and use for data input in my c programs.
MicroXML.zip with source code, simple example and exe-file for windows.
if you need to read some data from XML file:
<users>
 <user name="Mark">
  <param name="Age" value="21"/>
  <param name="Country" value="NL"/>
 </user>
 <user name="Nick">
  <param name="Age" value="60"/>
  <param name="Country" value="RU"/>
 </user>
</users>

You should write some of such code to use "MicroXML"

// User data to input and print 
 char name[256]="";
 float age=0;
 char country[32]="";

 int processXML(XMLmin xml)
{ // Callback procedure to analise xml
  // It is called with every tag 
  // For <XXX> is called with XML_OPEN flag
  // For </XXX> is called with XML_CLOSE flag
  // For <XXX /> is called with both XML_OPEN and XML_CLOSE flags
  // Text between tags is called with XML_TEXT flag
  // Example of parsing micro.xml file
 int tag;
 char s[256];

 if((tag = XML_isTag(xml,"user"))!=0)
   { // tag "user"
    if(tag & XML_OPEN)
      { // open "user" tag; tag may have "name" attribute
       if((XML_getString(xml,"name",s)) > 0) // if "user" has "name" copy it to name array
        { strcpy(name,s); }
       }
    if(tag & XML_CLOSE)
      {
       printf("name=%s  age=%.0f  country=%s\n",name,age,country);
       } // print data when close "user"
    } else
 if((tag = XML_isTag(xml,"param"))!=0)
   { // tag "param"
    if(tag & XML_OPEN)
      { // open "param" tag; tag may have "name" attribute
       if((XML_getString(xml,"name",s)) > 0)
         { // param has "name" attribute
          if(strcmp(s,"Age")==0) // name attribute equals "Age"
            { age=XML_getFloat(xml,"value",0); } // get attribute value in age variable as float
          if(strcmp(s,"Country")==0)// name attribute equals "Country"
            { if(XML_getString(xml,"value",s) > 0) strcpy(country,s); }  // get attribute value in country array
          }
       }
    if(tag & XML_CLOSE) { } //nothing to do when closing "param"
    }
 return 0;
 }

 int main(int na,char *args[])
{
 XMLmin xml;
 Stream stream;
 char fname[256]="micro.xml"; if(na > 1)strcpy(fname,args[1]);

 if((stream = Stream_open(fname,"r")) != 0) 
   {
    xml = new_XMLmin(8192,1024);
    xml->processTag = processXML;
    XML_stream(xml,stream);
    xml = nul_XMLmin(xml);
    Stream_close(stream);
    }
 return 0;
 }
The result is printed as:
name=Mark age=21 country=NL
name=Nick age=60 countre=RU