473,664 Members | 2,972 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 8346
"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
3709
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
6438
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
1733
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 infinite loop of metod calls and callbacks in my app, and eventually a stack overflow in the XmlDocument.
2
1756
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
2182
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 with 0 results using SelectNodes. If I take out both namespaces, the SelectNodes(XPathQuery) works...
2
4394
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
3216
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
2405
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
6814
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
8861
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8778
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8549
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
5660
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4185
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4351
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2764
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
2
2003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1759
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.