Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries [Thread Prev] >Thread Next - Re: XPath: SelectSingleNode failing to return node XPath: SelectSingleNode failing to return nodeTo: NULL Date: 10/20/2008 2:32:00 PM I have this xml which I retrieved from a Sharepoint web service:
<Views xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<View Name="{9E45B91C-199C-4403-8331-7F6AE2A30259}" Type="HTML"
DisplayName="All Items" Url="Lists/Incident Reports/AllItems.aspx"
BaseViewID="1" />
<View Name="{5C642326-44D2-4879-9E1D-B47220D88007}" DefaultView="TRUE"
Type="HTML" DisplayName="Display" Url="Lists/Incident
Reports/Display.aspx" BaseViewID="1" />
<View Name="{24E44148-FEEF-4D18-8440-C21593834D28}" Type="HTML"
Hidden="TRUE" DisplayName="" Url="default.aspx" BaseViewID="1" />
<View Name="{0BB83D50-7EEE-40C4-B564-8478AD077FA0}" Type="HTML"
DisplayName="Recent" Url="Lists/Incident Reports/Recent.aspx"
BaseViewID="1" />
<View Name="{C33294BE-E0D7-4210-B31C-91C8149242BB}" Type="HTML"
DisplayName="Dataview" Url="Lists/Incident Reports/Dataview.aspx"
BaseViewID="1" />
</Views>
I'm missing something obvious, but I can't figure out why this call to
SelectSinglenode (in vb.net) fails to return the desired node:
Dim ViewNode As Xml.XmlNode =
xmldoc.SelectSingleNode("//View[@DisplayName = ""Dataview""]")
sViewID = ViewNode.Attributes("Name").Value
If I do it the hard way, by looping, it works fine:
For Each xNode In xmldoc.DocumentElement.ChildNodes
If xNode.Attributes("DisplayName").Value = "Dataview" Then
sViewID = xNode.Attributes("Name").Value
Exit For
End If
Next
I'm going to move on, using the loop, but I would appreciate if someone
can tell me what the problem in my xpath query is.
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
