473,574 Members | 2,582 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GetListItems SelectNodes not working for me

I am getting no nodes from the following code:

'Put user code to initialize the page here
Dim listService As New com.domain.my.L ists
listService.Cre dentials =
System.Net.Cred entialCache.Def aultCredentials
Dim xmlDoc = New System.Xml.XmlD ocument

Dim ndQuery As XmlNode = xmlDoc.CreateNo de(XmlNodeType. Element,
"Query", "")
Dim ndViewFields As XmlNode = xmlDoc.CreateNo de(XmlNodeType. Element,
"ViewFields ", "")
Dim ndQueryOptions As XmlNode =
xmlDoc.CreateNo de(XmlNodeType. Element, "QueryOptio ns", "")

ndQueryOptions. InnerXml =
"<IncludeMandat oryColumns>FALS E</IncludeMandator yColumns>" + _
"<DateInUtc>TRU E</DateInUtc>"
ndViewFields.In nerXml = "<FieldRef Name='Title'/><FieldRef
Name='URL'/><FieldRef Name='Category'/>"
ndQuery.InnerXm l = ""

Try

Dim ndListItems As XmlNode = listService.Get ListItems("Tool bar",
Nothing, ndQuery, ndViewFields, Nothing, ndQueryOptions)

Dim doc As XmlDocument = New XmlDocument
doc.LoadXml(Rep lace(ndListItem s.InnerXml, ControlChars.Lf &
ControlChars.Lf , ""))
Dim nsmgr As XmlNamespaceMan ager = New
XmlNamespaceMan ager(doc.NameTa ble)
nsmgr.AddNamesp ace("z", "#RowsetSchema" )
nsmgr.AddNamesp ace("rs", "urn:schema s-microsoft.com:r owset")
Dim node As XmlNode
Dim xl As XmlNodeList = doc.SelectNodes ("/rs:data/z:row", nsmgr)
For Each node In xl
Debug.WriteLine (node.Attribute s("ows_Title" ))
Next
Debug.WriteLine (ndListItems.In nerXml)

Catch ex As System.Web.Serv ices.Protocols. SoapException

Debug.WriteLine ("Message:" & vbCrLf & ex.Message + vbCrLf +
"Detail:" + vbCrLf + ex.Detail.Inner Text + ControlChars.Lf + "StackTrace :" +
ControlChars.Lf + ex.StackTrace)
End Try

The following is the Outer XML that I am receiving back, which clearly has
records.

<listitems xmlns:s="uuid:B DC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
xmlns:dt="uuid: C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:s chemas-microsoft-com:rowset" xmlns:z="#Rowse tSchema"
xmlns="http://schemas.microso ft.com/sharepoint/soap/">

<rs:data ItemCount="3">
<z:row ows_Title="Yaho o" ows_URL="http://www.yahoo.com"
ows_Category="S ites" ows_ID="1" ows_owshiddenve rsion="1" />
<z:row ows_Title="Goog le" ows_URL="http://www.google.com"
ows_Category="T ools" ows_ID="2" ows_owshiddenve rsion="1" />
<z:row ows_Title="Shar ePoint Help"
ows_URL="/_vti_bin/help/1033/sps/html/SharePointHelp. htm" ows_Category="H elp"
ows_ID="3" ows_owshiddenve rsion="3" />
</rs:data>
</listitems>

Am I missing something?

Thanks!

Nov 12 '05 #1
3 8343
"Steve" <St***@discussi ons.microsoft.c om> wrote in message news:04******** *************** ***********@mic rosoft.com...
I am getting no nodes from the following code: : : nsmgr.AddNamesp ace("rs", "urn:schema s-microsoft.com:r owset") : : xmlns:rs="urn:s chemas-microsoft-com:rowset" xmlns:z="#Rowse tSchema" : : Am I missing something?


It all seems to be in order, except that the xmlns declaration of rs in the
instance document is

urn:schemas-microsoft-com:rowset

whereas the xmlns declaration you've added to the XmlNamespaceMan ager
is

urn:schemas-microsoft.com:r owset

If you look closely, you'll observe a dot-com in this namespace URI
whereas the URN has dash-com. This revision should help,

nsmgr.AddNamesp ace("rs", "urn:schema s-microsoft-com:rowset")
Derek Harmon
Nov 12 '05 #2
Derek,

Thank you very much! Even after reading your email I didn't see it right
away, but that did it.

Steve

"Derek Harmon" <lo*******@msn. com> wrote in message
news:eS******** ******@TK2MSFTN GP14.phx.gbl...
"Steve" <St***@discussi ons.microsoft.c om> wrote in message
news:04******** *************** ***********@mic rosoft.com...
I am getting no nodes from the following code:

: :
nsmgr.AddNamesp ace("rs", "urn:schema s-microsoft.com:r owset")

: :
xmlns:rs="urn:s chemas-microsoft-com:rowset" xmlns:z="#Rowse tSchema"

: :
Am I missing something?


It all seems to be in order, except that the xmlns declaration of rs in
the
instance document is

urn:schemas-microsoft-com:rowset

whereas the xmlns declaration you've added to the XmlNamespaceMan ager
is

urn:schemas-microsoft.com:r owset

If you look closely, you'll observe a dot-com in this namespace URI
whereas the URN has dash-com. This revision should help,

nsmgr.AddNamesp ace("rs", "urn:schema s-microsoft-com:rowset")
Derek Harmon

Nov 12 '05 #3

I am having a similar problem getting blank nodes. I have attached m
code (C#)

+----------------------------------------------------------------
| Attachment filename: code.txt
|Download attachment: http://www.mcse.ms/attachment.php?postid=3566859
+----------------------------------------------------------------

-
ckfinle
-----------------------------------------------------------------------
Posted via http://www.mcse.m
-----------------------------------------------------------------------
View this thread: http://www.mcse.ms/message1285233.htm

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3704
by: MacDk | last post by:
Hi, Given this: http://rss.asdf.dk/theothermusic.rss how do you use selectnodes/Xpath to return all title-items (//title is not working). I think it a problem with namespace but i can't solve the problem.
8
6434
by: e-mid | last post by:
i want to get childs of specific xml node. normally i use xmlNodeList fooList = myNode.SelectNodes("foo"); but in compactframework , there is no selectNodes() method or selectSingleNode() method. what else can i use instead?
1
1725
by: Riko Eksteen | last post by:
Hi I am writing an application that listens to the NodeInserted event, and if the event is fired it does a selectnodes xpath query on the XmlDocument. Only problem is, when I call SelectNodes(string, XmlNameSpaceManager) the NodeInserted event gets fired as well, without me doing any modifucation of the document. This results in an...
2
1755
by: Michael H | last post by:
Hello group, I have a some xml that looks like this below: <tuneRequests ct="3" xmlns:sql="urn:schemas-microsoft-com:xml-sql" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <tr xsi:type="trGenericType" number="2">
2
2180
by: Linda Boumarafi | last post by:
Hi, This is a newbie question to XMLNS. I just finished the article on "XML Namespaces and How They Affect XPath and XSLT" by Dare Obasanjo and I'm pretty sure I understand the problem. I just don't know how to achieve the desired XPath result. I'm dealing with an XML document that has two XMLNS' in the root node (Report) and I'm ending up...
2
4392
by: Joe | last post by:
Hello All: Does anyone know the differnce between the GetElementsByTagName method and the SelectNodes method? I know that they take different arguments. They also both return a NodeList. I'm wondering when would I use one vs. the other. TIA, -- Joe
2
3214
by: DeveloperX | last post by:
SelectNodes under 1.1 is confusing me. Imagine an xml file that looks like this. It's just an example: <drive> <dir a="a"> <file>aA</file> <file>aB</file> <dir a="ab"> <file>abA</file> <dir a=abc>
3
2403
by: John Smith | last post by:
I'm trying to make some Javascript X-browser. foo is a HTML DOM. I have foo.documentElement.selectNodes("xpath"); in the source. I see later down there is also a foo.transformNode. Yuck. Has someone written a x-browser selectNodes/transformNode implementation so that I can get this code working in a non IE browser??
3
6812
by: Alan Mailer | last post by:
Ok, I've looked for an answer for this, because I'm sure it's been asked a thousand times... but no luck... so here goes. Imagine I want to create a NodeList based on an XPath statement. The 'query' portion of that statement wants to search for the following value: Joe's Garage ....now please note the APOSTROPHE in the above string.
0
7732
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8063
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8243
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7822
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5626
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5302
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3754
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2249
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1347
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.