Note that there are some explanatory texts on larger screens.

plurals
  1. PORetrieving Data From XML File
    primarykey
    data
    text
    <p>I seem to be having a problem with retrieving XML values with C#, which I know it is due to my very limited knowledge of C# and .XML.</p> <p>I was given the following XML file</p> <pre><code>&lt;PowerBuilderRunTimes&gt; &lt;PowerBuilderRunTime&gt; &lt;Version&gt;12&lt;/Version&gt; &lt;Files&gt; &lt;File&gt;EasySoap110.dll&lt;/File&gt; &lt;File&gt;exPat110.dll&lt;/File&gt; &lt;File&gt;pbacc110.dll&lt;/File&gt; &lt;/File&gt; &lt;/PowerBuilderRunTime&gt; &lt;/PowerBuilderRunTimes&gt; </code></pre> <p>I am to process the XML file and make sure that each of the files in the exist in the folder (that's the easy part). It's the processing of the XML file that I have having a hard time with. Here is what I have done thus far:</p> <pre><code>var runtimeXml = File.ReadAllText(string.Format("{0}\\{1}", configPath, Resource.PBRuntimes)); var doc = XDocument.Parse(runtimeXml); var topElement = doc.Element("PowerBuilderRunTimes"); var elements = topElement.Elements("PowerBuilderRunTime"); foreach (XElement section in elements) { //pbVersion is grabbed earlier. It is the version of PowerBuilder if( section.Element("Version").Value.Equals(string.Format("{0}", pbVersion ) ) ) { var files = section.Elements("Files"); var fileList = new List&lt;string&gt;(); foreach (XElement area in files) { fileList.Add(area.Element("File").Value); } } } </code></pre> <p>My issue is that the String List is only ever populated with one value, "EasySoap110.dll", and everything else is ignored. Can someone please help me, as I am at a loss.</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