473,666 Members | 2,578 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xml selectnodes

i want to get childs of specific xml node. normally i use

xmlNodeList fooList = myNode.SelectNo des("foo");

but in compactframewor k , there is no selectNodes() method or
selectSingleNod e() method.

what else can i use instead?
Nov 12 '05 #1
8 6438
"e-mid" <someone@somewh ere> wrote in message news:OP******** ******@TK2MSFTN GP10.phx.gbl...
i want to get childs of specific xml node. normally i use

xmlNodeList fooList = myNode.SelectNo des("foo");
The luxury of the desktop! (to get child nodes, SelectNodes() is
overkill.)
but in compactframewor k , there is no selectNodes() method or
selectSingleNod e() method.

what else can i use instead?


Try myNode.ChildNod es. It's an XmlNodeList that you can
iterate over, and check the LocalName property on each
XmlNode in ChildNodes to see if it's "foo".
Derek Harmon
Nov 12 '05 #2
thknz Derek.
"Derek Harmon" <lo*******@msn. com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
"e-mid" <someone@somewh ere> wrote in message

news:OP******** ******@TK2MSFTN GP10.phx.gbl...
i want to get childs of specific xml node. normally i use

xmlNodeList fooList = myNode.SelectNo des("foo");


The luxury of the desktop! (to get child nodes, SelectNodes() is
overkill.)
but in compactframewor k , there is no selectNodes() method or
selectSingleNod e() method.

what else can i use instead?


Try myNode.ChildNod es. It's an XmlNodeList that you can
iterate over, and check the LocalName property on each
XmlNode in ChildNodes to see if it's "foo".
Derek Harmon

Nov 12 '05 #3
Yaar it is working
-----Original Message-----
thknz Derek.
"Derek Harmon" <lo*******@msn. com> wrote in message
news:%2******* *********@TK2MS FTNGP09.phx.gbl ...
"e-mid" <someone@somewh ere> wrote in message

news:OP******* *******@TK2MSFT NGP10.phx.gbl.. .
> i want to get childs of specific xml node. normally i use >
> xmlNodeList fooList = myNode.SelectNo des("foo");


The luxury of the desktop! (to get child nodes, SelectNodes() is overkill.)
> but in compactframewor k , there is no selectNodes() method or > selectSingleNod e() method.
>
> what else can i use instead?


Try myNode.ChildNod es. It's an XmlNodeList that you can
iterate over, and check the LocalName property on each
XmlNode in ChildNodes to see if it's "foo".
Derek Harmon

.

Nov 12 '05 #4
Actually I m testing this News Group...
bcos i want to develop samething...
-----Original Message-----
i want to get childs of specific xml node. normally i use

xmlNodeList fooList = myNode.SelectNo des("foo");

but in compactframewor k , there is no selectNodes() method orselectSingleNo de() method.

what else can i use instead?
.

Nov 12 '05 #5
Yaar I want to Know the complete herachy of this
system...How it work...i mean how message link with each
other
-----Original Message-----
i want to get childs of specific xml node. normally i use

xmlNodeList fooList = myNode.SelectNo des("foo");

but in compactframewor k , there is no selectNodes() method orselectSingleNo de() method.

what else can i use instead?
.

Nov 12 '05 #6
This is working...i got it...how it is working
-----Original Message-----
Actually I m testing this News Group...
bcos i want to develop samething...
-----Original Message-----
i want to get childs of specific xml node. normally i use

xmlNodeList fooList = myNode.SelectNo des("foo");

but in compactframewor k , there is no selectNodes()

method or
selectSingleN ode() method.

what else can i use instead?
.

.

Nov 12 '05 #7
Suresh Kumar wrote:
Actually I m testing this News Group...
bcos i want to develop samething...


Please, test in microsoft.publi c.test.here newsgroup.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #8
Here are some replacements I wrote which provide a subset of the "real"
framework:

' This function replicates the SelectSingleNod e MSXML function only
to the extent required by

' expressions such as /starting/next/next/element or
/starting/next/next/element/@attribute

Public Function SelectSingleNod e(ByVal xmldoc As XmlDocument, ByVal
sInput As String) As String

Dim sSelect() As String, sXML As String, i As Integer, xNode As
XmlNode, tNode As XmlNode

' Break down the input string

sSelect = Split(sInput, "/")

If UBound(sSelect) < 1 Then Return ""

' Get the first node

xNode = xmldoc.GetEleme ntsByTagName(sS elect(1)).Item( 0)

' go to the next-to-last element

For i = 2 To UBound(sSelect) - 1

If xNode.HasChildN odes Then

For Each tNode In xNode.ChildNode s

If tNode.Name = sSelect(i) Then

xNode = tNode

Exit For

End If

Next

Else

Return ""

End If

Next

' Handle last node or attribute

If Mid(sSelect(i), 1, 1) = "@" Then

If xNode.Attribute s(Mid(sSelect(i ), 2)) Is Nothing Then

Return ""

Else

Return xNode.Attribute s(Mid(sSelect(i ), 2)).InnerText

End If

Else

For Each tNode In xNode.ChildNode s

If tNode.Name = sSelect(i) Then

xNode = tNode

Exit For

End If

Next

If xNode Is Nothing Then Return ""

Return xNode.InnerText

End If

End Function

' This function replicates the SelectNodes MSXML function only to
the extent required by

' expressions such as /starting/next/next/element or
/starting/next/next/element/*

Public Function SelectNodes(ByV al xmldoc As XmlDocument, ByVal
sInput As String) As XmlNode()

Dim sSelect() As String, sXML As String, i As Integer, xNode As
XmlNode, tNode As XmlNode

Dim xList() As XmlNode

' Break down the input string

sSelect = Split(sInput, "/")

If UBound(sSelect) < 1 Then Return Nothing

' Get the first node

xNode = xmldoc.GetEleme ntsByTagName(sS elect(1)).Item( 0)

' go to the next-to-last element

For i = 2 To UBound(sSelect) - 1

If xNode.HasChildN odes Then

For Each tNode In xNode.ChildNode s

If tNode.Name = sSelect(i) Then

xNode = tNode

Exit For

End If

Next

Else

Return Nothing

End If

Next

' Handle last node

If Not xNode.HasChildN odes Then Return Nothing

For Each tNode In xNode.ChildNode s

If tNode.Name = sSelect(i) Or sSelect(i) = "*" Then

' Re-size array

If xList Is Nothing Then

' First time through, create the array

ReDim xList(0)

xList(0) = Nothing

Else

' Increase size by 1

ReDim Preserve xList(xList.Len gth())

End If

xList(xList.Len gth - 1) = tNode

End If

Next

If xList(0) Is Nothing Then Return Nothing

Return xList

End Function

"e-mid" <someone@somewh ere> wrote in message
news:OP******** ******@TK2MSFTN GP10.phx.gbl...
i want to get childs of specific xml node. normally i use

xmlNodeList fooList = myNode.SelectNo des("foo");

but in compactframewor k , there is no selectNodes() method or
selectSingleNod e() method.

what else can i use instead?

Nov 12 '05 #9

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

Similar topics

7
2784
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 am doing wrong?
4
4837
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 Data nodes containing the string 'mysearch' but I need to only find the ones where it's a whole word...
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
2183
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
8454
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8878
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...
1
8560
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
8644
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6200
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4200
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...
1
2776
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
2012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1778
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.