Note that there are some explanatory texts on larger screens.

plurals
  1. POC# Linq to XML, get parents when a child satisfy condition
    primarykey
    data
    text
    <p>I need some help. I have this xml document:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;MyItems&gt; &lt;Parent upc="A00000000000000000000001" sku="" archivo="pantalon1.jpg"&gt; &lt;Child upc="101" sku="" archivo="image##.jpg"&gt; &lt;GrandChild archivo="image##.jpg" /&gt; &lt;/Child&gt; &lt;Child upc="102" sku="" archivo="image##.jpg"&gt; &lt;GrandChild archivo="image##.jpg" /&gt; &lt;/Child&gt; &lt;/Parent&gt; &lt;Parent upc="A00000000000000000000002" sku="" archivo="image##.jpg"&gt; &lt;Child upc="101" sku="" archivo="image##.jpg"&gt; &lt;GrandChild archivo="image##.jpg" /&gt; &lt;/Child&gt; &lt;Child upc="102" sku="" archivo="image##.jpg"&gt; &lt;GrandChild archivo="image##.jpg" /&gt; &lt;/Child&gt; &lt;/Parent&gt; &lt;Parent upc="200" sku="" archivo="image##.jpg"&gt; &lt;Child upc="201" sku="" archivo="image##.jpg"&gt; &lt;GrandChild archivo="image##.jpg" /&gt; &lt;/Child&gt; &lt;Child upc="202" sku="" archivo="image##.jpg"&gt; &lt;GrandChild archivo="image##.jpg" /&gt; &lt;/Child&gt; &lt;/Parent&gt; &lt;/MyItems&gt; </code></pre> <p>Then, I'm trying to select all the 'Parents' where a 'Child' fullfil a condition. Example, all the parents wich contains a child where, child attribute upc is equal to <code>101</code></p> <p>I was studying this article: <a href="https://stackoverflow.com/questions/787240/best-linq-to-xml-query-to-select-nodes-based-on-properties-of-descendant-nodes">Select nodes based on properties of descendant nodes</a></p> <p>But I just cant get what I want.</p> <p>Thanks and have a nice day!</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