title: vala / libxml2 : how to query xpath with namespace ? (xpathRegisterNs?)
body: <p>how do you register namespace on context with vala so that you can query "//someNamespace:tag" (and not only "//tag")</p>
  
  <p>My starting point is : <a href="https://live.gnome.org/Vala/XmlSample" rel="nofollow noreferrer">https://live.gnome.org/Vala/XmlSample</a></p>
  
  <pre><code>            Xml.Doc* doc = Parser.parse_file (path);
              if(doc==null) print("failed to read the .xml file\n");
  
              Context ctx = new Context(doc);
              if(ctx==null) print("failed to create the xpath context\n");
  
              Xml.XPath.Object* obj = ctx.eval_expression("/Example/Objects/Pet");
              if(obj==null) print("failed to evaluate xpath\n");
  </code></pre>
  
  <p>I guessed[*] how to "create" some namespace</p>
  
  <pre><code>Xml.Ns* ns = new Xml.Ns(null,"","svg");
  </code></pre>
  
  <p>now how do I pass this namespace to the context ?<br>
  something like xpathRegisterNs that exists in .py (AFAIK)<br>
  <a href="https://stackoverflow.com/questions/8566111/python-xpath-libxml2-namespace-query">Python XPath / libxml2 namespace query</a></p>
  
  <p>If someone got some sample code to get the list of existing namespace in the doc it would be great too.</p>
  
  <p>PS: [*] I say I guessed because I hoped I'd found a good Linux IDE with vala completion. Right now I'm stuck with Monodevelop 2.8.6.3 which has syntax highlighting for vala but no code completion (It keeps saying "fetching information for the class" but I don't get any result). So if someone knows of a good ide, I'll be glad to hear you...</p>