Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get specific attributes from all xml files in directory?
    primarykey
    data
    text
    <p>I have a folder full of xml files. In these files many of them share a common attribute (Name), but have a secondary attribute that is different. I want to get a list of the unique entries based off reading these xml files. Below is an example of what the various xml files will contain.</p> <p><strong>File 1</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;results date="2013-12-29"&gt; &lt;A uniqueId="1234" Name="My-Machine"/&gt; &lt;error number="555"&gt; &lt;description&gt;&lt;![CDATA[House on Fire]]&gt;&lt;/description&gt; &lt;/error&gt; &lt;/results&gt; </code></pre> <p><strong>File 2</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;results date="2013-12-29"&gt; &lt;A uniqueId="1234" Name="My-Machine"/&gt; &lt;error number="556"&gt; &lt;description&gt;&lt;![CDATA[House in flood]]&gt;&lt;/description&gt; &lt;/error&gt; &lt;/results&gt; </code></pre> <p><strong>File 3</strong></p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;results date="2013-12-29"&gt; &lt;A uniqueId="1234" Name="My-Machine"/&gt; &lt;error number="556"&gt; &lt;description&gt;&lt;![CDATA[House in flood]]&gt;&lt;/description&gt; &lt;/error&gt; &lt;/results&gt; </code></pre> <p>I need to be able to read all the files, add each Name and description to a list (or possibly array). Output from example would look like this:</p> <pre><code>Name="MyMachine", description="![CDATA[House is flooding]]"; Name="MyMachine", description="![CDATA[House on fire]]"; Name="MyMachine", description="![CDATA[House on fire]]"; </code></pre> <p>It seems LINQ may be the best way to handle this since the files are very small in content.</p>
    singulars
    1. This table or related slice is empty.
    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.
    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