title: Read other xml elements based on the root node and one of the element?
body: <p>My XML is given below.</p>
  
  <pre><code>&lt;UrlRoutes&gt;
    &lt;ActivityPR&gt;
       &lt;Source&gt;activity/editactivity&lt;/Source&gt;
       &lt;DestinationController&gt;Activity&lt;/DestinationController&gt;
       &lt;DestinationAction&gt;Editactivity&lt;/DestinationAction&gt;  
    &lt;/ActivityPR&gt;
    &lt;UserSettings&gt;
       &lt;Source&gt;settings/subscriptions&lt;/Source&gt;
       &lt;DestinationController&gt;UserSettings&lt;/DestinationController&gt;
       &lt;DestinationAction&gt;GetUserPreferenceSettings&lt;/DestinationAction&gt;
    &lt;/UserSettings&gt;
  &lt;/UrlRoutes&gt;
  </code></pre>
  
  <p>I will have <code>Source</code> element value in a var say <code>sourceX</code> . Ex </p>
  
  <pre><code>SourceX = "settings/subscriptions" 
  </code></pre>
  
  <p>or </p>
  
  <pre><code>SourceX = "activity/editactivity"
  </code></pre>
  
  <p>I am trying to get the parent node using the below code, let me know if there is something wrong</p>
  
  <pre><code>XmlElement xmlNode = xmlDoc.GetElementById(SourceX);
  XmlNode parent = xmlNode.ParentNode;
  </code></pre>
  
  <p>Now for the combination for the parent node(say <code>ActivityPR</code> or <code>Usersettings</code>) and <code>Source</code>, I have to find the corresponding <code>DestinationController</code> and <code>DestinationAction</code>.</p>
  
  <p>How do I do that? Prefer traditional XML as opposed to LINQ as rest of the code is in that form.</p>
  
  <pre><code>if(node!=null)
          {
              XmlElement routeElement = (XmlElement)node;
  
  
              strController = routeElement.GetElementsByTagName("DestinationController")[0].InnerText.ToString();
              strAction = routeElement.GetElementsByTagName("DestinationAction")[0].InnerText.ToString();
  
  
          }
  </code></pre>