473,396 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

SelectSingleNode with XmlDataDocument

I have code that worked with an XMLDocument. Now I'm trying to convert it to use with a synchronized XML dataset loaded from my database. The only difference I can see is that the DataDocument constructer has added an xmlns attribute to the parent tag

I find that xDoc.GetElementsByTagName works fine, but xDoc.SelectSingleNode and xDoc.SelectNodes both return Nothing, even when there are clearly child nodes matching the request. The XML was created from a loaded dataset with nested relations. Here is my code. xNode is Nothing after the SelectSingleNode statement

Any help will be appreciated

Public Sub Add(ByVal xMfgNode As System.Xml.XmlNode
Dim sName As Strin
oMfg = New Manufacture
Dim xNode As XmlNod

xNode = xMfgNode.SelectSingleNode("mfgcode"

sName = xNode.Valu
oMfg.Name = sNam
oMfg.LoadMakers(xMfgNode, sName
oMfg.LoadProducts(xMfgNode, sName
mcolManufacturer.Add(oMfg
miCount = miCount +
oMfg = Nothin
End Su

This is the OuterXML of xMfgNode

<mfg xmlns="http://tempuri.org/Dataset1.xsd"><mfgId>1</mfgId><mfgcode>Paints</mfgcode><maker><makerId>2</makerId><mfgId>1</mfgId><makercode>Paints</makercode><product><productID>3</productID><makerId>2</makerId><proddesc>Blue</proddesc></product><product><productID>4</productID><makerId>2</makerId><proddesc>Green</proddesc></product></maker></mfg>
Nov 12 '05 #1
1 2446
H Irick wrote:
I find that xDoc.GetElementsByTagName works fine, but xDoc.SelectSingleNode and xDoc.SelectNodes both return Nothing, even when there are clearly child nodes matching the request. The XML was created from a loaded dataset with nested relations. Here is my code. xNode is Nothing after the SelectSingleNode statement.


It's a faq. Read about default namespace and XPath and take a look at
SelectSingleNode(string, XmlNamespaceManager) method documentation at MSDN.

--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com
Nov 12 '05 #2

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

Similar topics

3
by: John R. | last post by:
I have an application written in C# and i am using MS XML DOM! I have a document with the following structure (only the <DicEntry> - Elements are important): <NewDataSet...
1
by: Peter Feakins | last post by:
We're building some web services that are primarily being consumed by a .net application. We're returning datasets for that purpose. We're also have to provide access to these services to classic...
0
by: Raj | last post by:
hi, I associate dataset with one xmldatadocument? how can I disassociate from xmldatadocument, so I can associate with another xmldatadocument. and, how can I remove xmldatadocument from...
0
by: gilly3 | last post by:
Reposting to a more relevant group. I am passing a generic dataset into a new XMLDataDocument and then parsing the XML with XSLT. The idea being that I can parse any dataset with the same xslt,...
2
by: James Ankrom | last post by:
Why does this fail? Dim relResources As New Data.DataRelation("Application_Resources", ..Tables("User_Applications").Columns("Application_id"),...
1
by: Coco | last post by:
I want to select a single which has the mix attribute value <= 40 and max attribute >= 40 node from the following xml <range> <age min="21" max="30"></age> <height min="1.2"...
0
by: Steve | last post by:
I have a dataset. I fill it with two recordsets from SQL queries. Tables are called tblPlanFYSpendingStage, tblSpendingStage.
4
by: Adrian Meyer | last post by:
Hi, On the server I code the following web service: ))] public XmlDataDocument GetTypedXmlDataDocument() { sqlDataAdapter1.Fill(typedDataSet1); XmlDataDocument dataDoc
1
by: JD | last post by:
I have a DataGridView with a DataSet as DataSource. The user can update the contents of the DataGridView, and then click on a Save button to save the data to an XML file. When they click on...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.