Need a help on XPathNodeIterator

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
Im new to LINQ-XML, Im developing an Infopath forum, infopath forum makes query to webservice and pulls data in XML format.
XML Format looks like below
<pre><GetOwnerForSiteResponse xmlns="http://tempuri.org/
<GetOwnerForSiteResult>
<UserRole>
<UserRoleID>56</UserRoleID>
<SiteID>c018c049-f18b-4b59-b345-2c1d0e7b2695</SiteID>
<WebID>8f427dce-9d8f-45f0-88c4-f4c6300d100d</WebID>
<Name>msarang</Name>
<Role> Owner</Role>
<StartDate>2011-05-17T02:26:05.293</StartDate>
<EndDate xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
<NTID>msarang</NTID>
<Description>IT</Description>
<DelegateForID xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
<RoleID xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</UserRole><pre><UserRole>
<UserRoleID>56</UserRoleID>
<SiteID>c018c049-f18b-4b59-b345-2c1d0e7b2695</SiteID>
<WebID>8f427dce-9d8f-45f0-88c4-f4c6300d100d</WebID>
<Name>msarang</Name>
<Role> Owner</Role>
<StartDate>2011-05-17T02:26:05.293</StartDate>
<EndDate xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
<NTID>msarang</NTID>
<Description>IT</Description>
<DelegateForID xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
<RoleID xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />
</UserRole>[/code]
[/code]
<pre> [/code]
Now i need all UserRole elements in above XML. I have wriiten all kinds of XPath query but it didnot work for me . Can any tell me how to get all UserRoles of above XML Code.
I tried @ my end like below
<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <font face="Consolas" size="2" style="font-size:x-small; font-family:Consolas

</font>
<span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas XPathDocument<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas
document = <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas new<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas
<span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas XPathDocument<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas (<span style="font-size:x-small; color:#a31515; font-family:Consolas <span style="font-size:x-small; color:#a31515; font-family:Consolas <span style="font-size:x-small; color:#a31515; font-family:Consolas "Books.xml"<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas ,System.Xml.<span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas XmlSpace<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas .None);
<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas
<span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas XPathNavigator<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas navigator
= document.CreateNavigator();
<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <font face="Consolas" size="2" color="#2b91af" style="font-size:x-small; color:#2b91af; font-family:Consolas
XPathNodeIterator
</font>



<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas nodes = navigator.Select("<span style="font-size:x-small; color:#a31515; font-family:Consolas <span style="font-size:x-small; color:#a31515; font-family:Consolas <span style="font-size:x-small; color:#a31515; font-family:Consolas /GetOwnerForSiteResponse/GetOwnerForSiteResult"



<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas );<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <font face="Consolas" size="2" color="#0000ff" style="font-size:x-small; color:#0000ff; font-family:Consolas
while
</font>



<span style="font-size:x-small; font-family:Consolas
<span style="font-size:x-small; font-family:Consolas <span style="color:#000000 (iterator.MoveNext()) ///THIS IS ALWAYS FALSE. NOT SURE what is worng with it, is it problem for not including namespace

{
<font face="Consolas" size="2" style="font-size:x-small; font-family:Consolas

</font>




<span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas Console<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas .WriteLine(iterator.Current.Value
+ <span style="font-size:x-small; color:#a31515; font-family:Consolas <span style="font-size:x-small; color:#a31515; font-family:Consolas <span style="font-size:x-small; color:#a31515; font-family:Consolas ":"
<span style="font-size:x-small; font-family:Consolas
<span style="font-size:x-small; font-family:Consolas + iterator.Current.Name);

}
<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas Please
help me on this urgent issue
<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas
<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; color:#2b91af; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; color:#0000ff; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas




<span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <span style="font-size:x-small; font-family:Consolas <hr class="sig Mahender

View the full article
 
Back
Top