title: Reading xml with libxml2 in C
body: <p>I have the following XML File: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" standalone="yes"?&gt;
  &lt;category&gt;
      &lt;data&gt;
          &lt;ca0&gt;100&lt;/ca0&gt;
          &lt;ca1&gt;Spielfilm&lt;/ca1&gt;
          &lt;ca2&gt;Spielfilm&lt;/ca2&gt;
      &lt;/data&gt;
      &lt;data&gt;
          &lt;ca0&gt;200&lt;/ca0&gt;
          &lt;ca1&gt;Serie&lt;/ca1&gt;
          &lt;ca2&gt;Serie&lt;/ca2&gt;
      &lt;/data&gt;
  &lt;/category&gt;
  </code></pre>
  
  <p>I am developing a C program, which should read this XML file and transfer it into a MySQL database. I have looked at several examples but I didn't succeed. </p>
  
  <p>To read the XML I use: </p>
  
  <pre><code>reader = xmlReaderForFile("/tmp/category.xml", NULL, 0);
  xmlTextReaderRead(reader);
  name = xmlTextReaderName(reader);
  if (!xmlStrcmp(name, (const xmlChar *) "category"))
  {
      xmlTextReaderRead(reader);
      name = xmlTextReaderName(reader);
      if(!xmlStrcmp(name, (const xmlChar*) "data")) {
          xmlTextReaderRead(reader);
          name = xmlTextReaderName(reader);
      }
  }
  </code></pre>
  
  <p>I expected that <code>name</code> contained "ca0", but it is empty. Why?</p>