Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

selectsinglenode

SelectSingleNode returns null when tag contains xmlNamespace

April 18, 2023 by Tarik

You should use an XmlNamespaceManager in your call to SelectSingleNode(): XmlNamespaceManager ns = new XmlNamespaceManager(xmldoc.NameTable); ns.AddNamespace(“msbld”, “http://schemas.microsoft.com/developer/msbuild/2003”); XmlNode node = xmldoc.SelectSingleNode(“//msbld:Compile”, ns);

Categories c# Tags c++, selectnodes, selectsinglenode, xml, xmldocument Leave a comment

Why is XmlNamespaceManager necessary?

February 18, 2023 by Tarik

The basic point (as pointed out by Kev, above), is that the namespace URI is the important part of the namespace, rather than the namespace prefix, the prefix is an “arbitrary convenience” As for why you need a namespace manager, rather than there being some magic that works it out using the document, I can … Read more

Categories .net Tags .net, selectsinglenode, xml-namespaces, xpath Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa