<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>XML and XmlDataSource Control</title><link>http://forums.asp.net/43.aspx</link><description>All about XML, XSLT, and the XmlDataSource control.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: select single node question</title><link>http://forums.asp.net/thread/3269545.aspx</link><pubDate>Wed, 01 Jul 2009 18:04:22 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3269545</guid><dc:creator>Martin_Honnen</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3269545.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=3269545</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Let&amp;#39;s assume the XML you have is&lt;/p&gt;&lt;pre class="xhtml" name="code"&gt;&amp;lt;response&amp;gt;
  &amp;lt;lst name=&amp;quot;responseHeader&amp;quot;&amp;gt;
    &amp;lt;int name=&amp;quot;status&amp;quot;&amp;gt;0&amp;lt;/int&amp;gt;
    &amp;lt;lst name=&amp;quot;params&amp;quot;&amp;gt;
      &amp;lt;str name=&amp;quot;rows&amp;quot;&amp;gt;50&amp;lt;/str&amp;gt;
    &amp;lt;/lst&amp;gt;
  &amp;lt;/lst&amp;gt;
&amp;lt;/response&amp;gt;
&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;then this snippet of C#&lt;/p&gt;&lt;pre class="c-sharp" name="code"&gt;            XmlDocument xmlDocumentInstance = new XmlDocument();
            xmlDocumentInstance.Load(@&amp;quot;..\..\XMLFile1.xml&amp;quot;);
            XmlElement el = xmlDocumentInstance.SelectSingleNode(&amp;quot;//str[@name = &amp;#39;rows&amp;#39;]&amp;quot;) as XmlElement;
            if (el != null)
            {
                Console.WriteLine(el.InnerText);
            }
&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;outputs 50.&lt;/p&gt;</description></item><item><title>Re: select single node question</title><link>http://forums.asp.net/thread/3269515.aspx</link><pubDate>Wed, 01 Jul 2009 17:47:16 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3269515</guid><dc:creator>tpiazza55</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3269515.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=3269515</wfw:commentRss><description>&lt;pre class="c-sharp" name="code"&gt;&lt;pre class="c-sharp" name="code"&gt;&amp;lt;response&amp;gt;
	&amp;lt;lst name=&amp;quot;responseHeader&amp;quot;&amp;gt;		   
                          &amp;lt;int name=&amp;quot;status&amp;quot;&amp;gt;0&amp;lt;/int&amp;gt;	  
                          &amp;lt;lst name=&amp;quot;params&amp;quot;&amp;gt;
		&amp;lt;str name=&amp;quot;rows&amp;quot;&amp;gt;50&amp;lt;/str&amp;gt;
	           &amp;lt;/lst&amp;gt;
	&amp;lt;/lst&amp;gt;
&amp;lt;/response&amp;gt;

&lt;/pre&gt;&lt;br /&gt;i need the vlaue of rows&lt;/pre&gt;</description></item><item><title>Re: select single node question</title><link>http://forums.asp.net/thread/3269496.aspx</link><pubDate>Wed, 01 Jul 2009 17:36:19 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3269496</guid><dc:creator>Martin_Honnen</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3269496.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=3269496</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Please post the real XML you have and we can find out why the XPath does not find anything. Namespaces might be one reason.&lt;/p&gt;
&lt;p&gt;What you have posted now is not XML at all as you have start tags &amp;lt;lst&amp;gt; which need to be closed as &amp;lt;/lst&amp;gt; but you have not done that.&lt;/p&gt;</description></item><item><title>Re: select single node question</title><link>http://forums.asp.net/thread/3269474.aspx</link><pubDate>Wed, 01 Jul 2009 17:19:58 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3269474</guid><dc:creator>tpiazza55</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3269474.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=3269474</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;li&gt;&lt;span&gt;&lt;span&gt;&amp;lt;lst&amp;nbsp;name=&lt;/span&gt;&lt;span&gt;&amp;quot;counts&amp;quot;&lt;/span&gt;&lt;span&gt;&amp;gt; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;lst&amp;nbsp;name=&lt;/span&gt;&lt;span&gt;&amp;quot;fields&amp;quot;&lt;/span&gt;&lt;span&gt;&amp;gt; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;lst&amp;nbsp;name=&lt;/span&gt;&lt;span&gt;&amp;quot;ID&amp;quot;&lt;/span&gt;&lt;span&gt;&amp;gt; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;&lt;/span&gt;&lt;span&gt;int&lt;/span&gt;&lt;span&gt;&amp;nbsp;name=&lt;/span&gt;&lt;span&gt;&amp;quot;1&amp;quot;&lt;/span&gt;&lt;span&gt;&amp;gt;14&amp;lt;/&lt;/span&gt;&lt;span&gt;int&lt;/span&gt;&lt;span&gt;&amp;gt; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;lst&amp;gt; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;lst&amp;gt; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&amp;lt;lst&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;p&gt;&lt;span&gt;what i need to do is get to the name=&amp;quot;1&amp;quot; so i can getthe value 14&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;XmlElement el = xmlDocumentInstance.SelectSingleNode(&amp;quot;//int[@name = 1]&amp;quot;) as XmlElement; &lt;/p&gt;
&lt;p&gt;doesnt seem to find it&lt;/p&gt;
&lt;p&gt;&lt;span&gt;the only way i have been able to get to it is using foreach node and drilling down that way&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: select single node question</title><link>http://forums.asp.net/thread/3269439.aspx</link><pubDate>Wed, 01 Jul 2009 16:52:59 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3269439</guid><dc:creator>Martin_Honnen</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3269439.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=3269439</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;What does SelectSingleNode have to do with Attributes.GetNamedItem? I don&amp;#39;t understand your question.&lt;/p&gt;
&lt;p&gt;If you want to find the first element where the name attribute has the value 1 then use&lt;/p&gt;
&lt;p&gt;XmlElement el = xmlDocumentInstance.SelectSingleNode(&amp;quot;//*[@name = 1]&amp;quot;) as XmlElement;&lt;/p&gt;
&lt;p&gt;If you want to find the first int element where the name attribute has the value 1 then use&lt;/p&gt;
&lt;p&gt;XmlElement el = xmlDocumentInstance.SelectSingleNode(&amp;quot;//int[@name = 1]&amp;quot;) as XmlElement;&lt;/p&gt;
&lt;p&gt;If that does not help then you need to elaborate why you think you need Attributes.GetNamedItem with SelectSingleNode or what exactly you want to achieve.&lt;/p&gt;</description></item><item><title>select single node question</title><link>http://forums.asp.net/thread/3269408.aspx</link><pubDate>Wed, 01 Jul 2009 16:37:01 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3269408</guid><dc:creator>tpiazza55</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3269408.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=43&amp;PostID=3269408</wfw:commentRss><description>&lt;pre class="c-sharp:nogutter" name="code"&gt;how do i do a selectsinglenode to get to the name = 1 node when i have to use &lt;font size="2"&gt;Attributes.GetNamedItem(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;name&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;)&lt;/font&gt;&lt;/pre&gt;&lt;pre class="c-sharp:nogutter" name="code"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="c-sharp:nogutter" name="code"&gt;&amp;lt;lst name=&amp;quot;counts&amp;quot;&amp;gt;
    &amp;lt;lst name=&amp;quot;fields&amp;quot;&amp;gt;
         &amp;lt;lst name=&amp;quot;ID&amp;quot;&amp;gt;
              &amp;lt;int name=&amp;quot;1&amp;quot;&amp;gt;14&amp;lt;/int&amp;gt;
         &amp;lt;lst&amp;gt;
    &amp;lt;lst&amp;gt;
&amp;lt;lst&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>