473,385 Members | 1,372 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,385 software developers and data experts.

SelectNodes

I am having a bit of a brainfart here at 4am in the morning.
I have
XmlNodeList TmpServers = ServerNodes.SelectNodes("[server='" +
DataSource + "']");

and I have also tried

XmlNodeList TmpServers = ServerNodes.SelectNodes("server='" + DataSource
+ "'");

DataSource is computername\instancename

TmpServer contains children nodes of server with values that i wish to
compare

I know that if i were doing it from the root node i would do something like
"/root/BleahNode[server='" + DataSource + "']"

I am sure it is something obviously simple that I am missing but for the
life of me i can't figure out what I am doing wrong.
Nov 12 '05 #1
2 2695
jo*****@driver.net wrote:
I have
XmlNodeList TmpServers = ServerNodes.SelectNodes("[server='" +
DataSource + "']");
[server='foo'] isn't valid XPath expression.

and I have also tried

XmlNodeList TmpServers = ServerNodes.SelectNodes("server='" + DataSource
+ "'");
server='foo' isn't selection path either.

Try something like
XmlNodeList TmpServers = ServerNodes.SelectNodes("*[server='" + DataSource + "']");


--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #2
Thanks. I knew i was missing something. I had tried .[ in desparation and
had forgotten about the *
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:OP**************@TK2MSFTNGP12.phx.gbl...
jo*****@driver.net wrote:
I have
XmlNodeList TmpServers = ServerNodes.SelectNodes("[server='" +
DataSource + "']");


[server='foo'] isn't valid XPath expression.

and I have also tried

XmlNodeList TmpServers = ServerNodes.SelectNodes("server='" +
DataSource + "'");


server='foo' isn't selection path either.

Try something like
XmlNodeList TmpServers = ServerNodes.SelectNodes("*[server='" +
DataSource + "']");


--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com

Nov 12 '05 #3

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

Similar topics

7
by: Robert Mark Bram | last post by:
Hi All! In the code below, I am reading in an xhtml document and attempting to use selectNodes to find a <p id="rmb"> node.. But the result is: 2 - */* 0 - */p Can anyone suggest what I...
4
by: Andrew Parsons | last post by:
Hey all, I have the following code to get a set of nodes containing a certain search criteria: theSearchTermsXML.selectNodes("/Table/Row/Cell") This works fine to a point - it finds all...
8
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()...
1
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...
2
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...
2
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...
2
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...
2
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...
3
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. ...
3
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.