title: Parse an xml in C using string functions
body: <p>I have an xml file which I have to read and parse to find out one value.</p>
  
  <p>I have this value mentioned within tags at two places in the file as follows:</p>
  
  <pre><code>&lt;length&gt;xx&lt;/length&gt;
  
  &lt;length type = "float"&gt;yy&lt;/length&gt;
  </code></pre>
  
  <p>I need to extract xx and yy. I am using simple string functions(owing to size restrictions I cant use xml Parsers).</p>
  
  <p>What string functions would help me extract xx and yy?</p>
  
  <p>I tried strtok() on these lines but without success..:</p>
  
  <pre><code>fp = fopen( "trial.xml", "r" );
      if(fp == NULL){
          perror("file missing");
      }
  
  
      while (fgets (buffer, sizeof (buffer), fp) != NULL) {
                  char *p;
              p = strstr(buffer, "&lt;length");
              if(p != NULL){
              printf("p = %s\n", p);
              p = strtok (p, "&lt;&gt;");
              printf("strtok 1, p = %s\n", p);
              p = strtok (NULL, "&lt;&gt;");
              printf("p = %s\n", p);
           }
  </code></pre>