Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing SelectSingleNode with XPath returns NULL
    primarykey
    data
    text
    <p>I trying to modify an XML file with <code>SelectSingleNode</code>. The structure of file is </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt; &lt;ProjectExtensions&gt; &lt;Borland.Personality&gt;Delphi.Personality&lt;/Borland.Personality&gt; &lt;Borland.ProjectType&gt;VCLApplication&lt;/Borland.ProjectType&gt; &lt;BorlandProject&gt; &lt;BorlandProject&gt; &lt;Delphi.Personality&gt; &lt;Parameters&gt; ... &lt;/Parameters&gt; &lt;VersionInfo&gt; &lt;VersionInfo Name="IncludeVerInfo"&gt;True&lt;/VersionInfo&gt; &lt;VersionInfo Name="AutoIncBuild"&gt;False&lt;/VersionInfo&gt; &lt;VersionInfo Name="MajorVer"&gt;4&lt;/VersionInfo&gt; &lt;VersionInfo Name="MinorVer"&gt;1&lt;/VersionInfo&gt; &lt;VersionInfo Name="Release"&gt;3&lt;/VersionInfo&gt; &lt;VersionInfo Name="Build"&gt;559&lt;/VersionInfo&gt; &lt;VersionInfo Name="Debug"&gt;False&lt;/VersionInfo&gt; &lt;VersionInfo Name="PreRelease"&gt;False&lt;/VersionInfo&gt; &lt;VersionInfo Name="Special"&gt;False&lt;/VersionInfo&gt; &lt;VersionInfo Name="Private"&gt;False&lt;/VersionInfo&gt; &lt;VersionInfo Name="DLL"&gt;False&lt;/VersionInfo&gt; &lt;VersionInfo Name="Locale"&gt;1049&lt;/VersionInfo&gt; &lt;VersionInfo Name="CodePage"&gt;1251&lt;/VersionInfo&gt; &lt;/VersionInfo&gt; ... ... ... </code></pre> <p>My code on VS C# is </p> <pre><code>using System.Xml; namespace xmledit { class Program { private static void Main(string[] args) { XmlDocument doc = new XmlDocument(); doc.Load("arm.xml"); var node = doc.SelectSingleNode("//VersionInfo[@Name='Build']"); if (node != null) node.InnerText = "123"; doc.Save("temp.xml"); } } } </code></pre> <p>So, i trying to modify Tag <code>VersionInfo</code> with <code>Name="Build"</code>, but <code>SelectSingleNode</code> returns <code>NULL</code>. What I doing wrong?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload