Note that there are some explanatory texts on larger screens.

plurals
  1. POC# XmlNode has ancestor type
    primarykey
    data
    text
    <p>I have an XmlDocument in the format below. If I perform the following search</p> <pre><code>XmlNode title = xmlDoc.SelectNodes("//Book/Title[contains(., \"Title3\")]"); </code></pre> <p>I will get back an XmlNode which is a title. How do I find out if that book falls under publications? I don't always want to assume that title.ParentNode.ParentNode.ParentNode exists. There should be an intuitive way to say:</p> <pre><code>if(title.hasAncestor("Publication") != null) { // do whatever } </code></pre> <p>Any help will be greatly appreciated</p> <pre><code>&lt;Publications&gt; &lt;Novel&gt; &lt;Book&gt; &lt;Title&gt;Title1&lt;/Title&gt; &lt;Author&gt;Author1&lt;/Author&gt; &lt;Year&gt;2000&lt;/Year&gt; &lt;/Book&gt; &lt;Book&gt; &lt;Title&gt;Title2&lt;/Title&gt; &lt;Author&gt;Author2&lt;/Author&gt; &lt;Year&gt;2000&lt;/Year&gt; &lt;/Book&gt; &lt;/Novel&gt; &lt;History&gt; &lt;Book&gt; &lt;Title&gt;Title3&lt;/Title&gt; &lt;Author&gt;Author3&lt;/Author&gt; &lt;Year&gt;2000&lt;/Year&gt; &lt;/Book&gt; &lt;Book&gt; &lt;Title&gt;Title4&lt;/Title&gt; &lt;Author&gt;Author4&lt;/Author&gt; &lt;Year&gt;2000&lt;/Year&gt; &lt;/Book&gt; &lt;/History&gt; &lt;/Publications&gt; &lt;StudyGuides&gt; &lt;Math&gt; &lt;Book&gt; &lt;Title&gt;Title5&lt;/Title&gt; &lt;Author&gt;Author5&lt;/Author&gt; &lt;Year&gt;2000&lt;/Year&gt; &lt;/Book&gt; &lt;Book&gt; &lt;Title&gt;Title6&lt;/Title&gt; &lt;Author&gt;Author6&lt;/Author&gt; &lt;Year&gt;2000&lt;/Year&gt; &lt;/Book&gt; &lt;/Math&gt; &lt;Science&gt; &lt;Book&gt; &lt;Title&gt;Title7&lt;/Title&gt; &lt;Author&gt;Author7&lt;/Author&gt; &lt;Year&gt;2000&lt;/Year&gt; &lt;/Book&gt; &lt;Book&gt; &lt;Title&gt;Title8&lt;/Title&gt; &lt;Author&gt;Author8&lt;/Author&gt; &lt;Year&gt;2000&lt;/Year&gt; &lt;/Book&gt; &lt;/Science&gt; &lt;/StudyGuides&gt; </code></pre>
    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.
    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