title: libxml - getting attributes
body: <p>I'm using LibXML. I use the xml file:</p>
  
  <pre><code>&lt;all&gt;
  &lt;material name1= "AS4C" name2="IPS06"/&gt;
      &lt;associated name1="IMA_1" name2="IPS05"/&gt;
      &lt;associated name1="IMA_2" name2="IPS05"/&gt;
      &lt;associated name1="IMA_3" name2="IPS05"/&gt;
      &lt;associated name1="AS4C" name2="IPS05"/&gt;
      &lt;associated name1="AS3C" name2="IPS05"/&gt;
  &lt;material /&gt;
  
  &lt;material name1="IMA_1" name2="IPS06"/&gt;
      &lt;associated name1="IMA_1" name2="IPS05"/&gt;
      &lt;associated name1="AS4C" name2="IPS05"/&gt;
      &lt;associated name1="HTA_M" name2="IPS05"/&gt;
      &lt;associated name1="IMA_M21E" name2="IPS05"/&gt;
  &lt;material /&gt;
  &lt;/all&gt;
  </code></pre>
  
  <p>I'm trying to check if for example <strong>associated name1="IMA_3" name2="IPS05"/</strong> exists in <strong>material name1= "AS4C" name2="IPS06"/</strong>. But the result is empty (xmlXPathNodeSetIsEmpty(result->nodesetval)
  I think that the path is not true.</p>
  
  <pre><code>string s_mat1 = "AS4C";
  string s_spec1 = "IPS06";
  string s_mat2 = "IMA_3";
  string s_spec2 = "IPS05";
  sPath &lt;&lt;  "/all/material[@name1=\"" &lt;&lt; s_mat1 &lt;&lt; "\"][@name2=\"" &lt;&lt; s_spec1 &lt;&lt; "\"]/associated[@name1=\"" &lt;&lt; s_mat2 &lt;&lt; "\"][@name2=\"" &lt;&lt; s_spec2 &lt;&lt; "\"]";
  result = xmlXPathEvalExpression((xmlChar *) sPath.str().c_str(), ctxt);
  if(xmlXPathNodeSetIsEmpty(result-&gt;nodesetval)){
      cout &lt;&lt; "empty" &lt;&lt; endl;
  }
  if (result-&gt;type == XPATH_NODESET) {
  
          xmlNodePtr matNode = result-&gt;nodesetval-&gt;nodeTab[0];
          xmlChar *matNode2 = xmlNodeGetContent(matNode);
  
          struct _xmlAttr* matAttr = matNode-&gt;properties;
  
          while (matAttr) {
              cout &lt;&lt; "matAttr :" &lt;&lt; string((char *)matAttr-&gt;name) &lt;&lt; endl;
              if (string((char *)matAttr-&gt;name)=="name1" &amp;&amp; matAttr-&gt;children){
                  string name1= string((char *)matAttr-&gt;children-&gt;content);
                  cout &lt;&lt; "___ name1==" &lt;&lt; name1&lt;&lt; endl;
  
                  xmlChar* value = xmlNodeListGetString(matNode-&gt;doc, matAttr-&gt;children, 1);
                  cout &lt;&lt; "value ==" &lt;&lt; string((char *)value)  &lt;&lt; endl;
  
              }
              else if (string((char *)matAttr-&gt;name)=="name2"){
                  string name2= string((char *)matAttr-&gt;children-&gt;content);
                  cout &lt;&lt; "___ name2==" &lt;&lt; name2&lt;&lt; endl;
              }
              matAttr = matAttr-&gt;next;
          }
  }
  </code></pre>
  
  <p>Thanks.</p>