title: Filtering out namespace errors when parsing partial XML via libxml2 in C++
body: <p>I have the need to parse partial XML fragments (which are presented as std::string), such as this one:</p>
  
  <p><code>&lt;FOO:node&gt;val&lt;/FOO:node&gt;</code></p>
  
  <p>as <code>xmlDoc</code> objects in libxml2, and because these are fragments, I keep getting the <code>namespace error : Namespace prefix FOO on node is not defined</code> errors spit out into STDERR.</p>
  
  <p>What I am looking for is for either a way to filter just these namespace warnings out or parse the XML fragment straight into a <code>xmlNode</code> object.</p>
  
  <p>I think some sort of hacking around with initGenericErrorDefaultFunc() may be in order to go the first way, but the documentation for libxml2 is absolutely atrocious.</p>
  
  <p>I would frankly prefer to go with the 2nd approach because it would require no error hacking and the node would be already aware of the namespace, but I don't think it's possible because the node has to have a root and XML fragments are not guaranteed to have only one root.</p>
  
  <p>I just need some guidance here of how to rid myself of the namespace error warning.</p>
  
  <p>Thank you very much.</p>