473,508 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

selectnodes in XML DOM document

Hi,

I have the following xml file.

<Navigator xmlns="urn:uuid:721DCCFA-8250-4820-8C7D-
7AF0E52305FD">
<SMDataSet RegionName="NA" CustomerName="ATT"
MarketName="New Jersey" DataSetName="SMDS1"
Technology="CDMA" StartDateAndTime="2003-06-
01T00:00:00.0000000-04:00" EndDate="2003-06-
02T00:00:00.0000000-04:00" Duration="10" ECPVersion="1.0"

<AntennaIdentifier CellNumber="1" AntennaNumber="1"
Azimuth="2" Latitude="54.45" Longitude="54.45">
<ServiceMeasurementMetric Name="mt1"
CapacityOfAverages="1.1"/>
</AntennaIdentifier>
<AntennaIdentifier CellNumber="1" AntennaNumber="2"
Azimuth="2" Latitude="54.45" Longitude="54.45">
<ServiceMeasurementMetric Name="mt1"
CapacityOfAverages="1.1"/>
</AntennaIdentifier>
<AntennaIdentifier CellNumber="2" AntennaNumber="1"
Azimuth="2" Latitude="54.45" Longitude="54.45"/>
<ServiceMeasurementMetric Name="mt1"
CapacityOfAverages="1.1"/>
<ServiceMeasurementMetric Name="mt2"
CapacityOfAverages="1.1"/>
</SMDataSet>
</Navigator>

Can some please tell me the Xpath query that should be
used in the selectNodes of DOMDocument that selects only
the AntennaIdentifier nodes under the SMDataSet node. In
entire doucment there will be only one SMDataSet node. I
am at the docuemnt node level.

Some how i am not able to make this work.

thank you
suresh
Nov 11 '05 #1
2 5665
"Navigator/SMDataSet/AntennaIdentifier"
or
"//AntennaIdentifier"

Chad

"suresh" <sm**@lucent.com> wrote in message
news:8c****************************@phx.gbl...
Hi,

I have the following xml file.

<Navigator xmlns="urn:uuid:721DCCFA-8250-4820-8C7D-
7AF0E52305FD">
<SMDataSet RegionName="NA" CustomerName="ATT"
MarketName="New Jersey" DataSetName="SMDS1"
Technology="CDMA" StartDateAndTime="2003-06-
01T00:00:00.0000000-04:00" EndDate="2003-06-
02T00:00:00.0000000-04:00" Duration="10" ECPVersion="1.0"

<AntennaIdentifier CellNumber="1" AntennaNumber="1"
Azimuth="2" Latitude="54.45" Longitude="54.45">
<ServiceMeasurementMetric Name="mt1"
CapacityOfAverages="1.1"/>
</AntennaIdentifier>
<AntennaIdentifier CellNumber="1" AntennaNumber="2"
Azimuth="2" Latitude="54.45" Longitude="54.45">
<ServiceMeasurementMetric Name="mt1"
CapacityOfAverages="1.1"/>
</AntennaIdentifier>
<AntennaIdentifier CellNumber="2" AntennaNumber="1"
Azimuth="2" Latitude="54.45" Longitude="54.45"/>
<ServiceMeasurementMetric Name="mt1"
CapacityOfAverages="1.1"/>
<ServiceMeasurementMetric Name="mt2"
CapacityOfAverages="1.1"/>
</SMDataSet>
</Navigator>

Can some please tell me the Xpath query that should be
used in the selectNodes of DOMDocument that selects only
the AntennaIdentifier nodes under the SMDataSet node. In
entire doucment there will be only one SMDataSet node. I
am at the docuemnt node level.

Some how i am not able to make this work.

thank you
suresh

Nov 11 '05 #2
You just need to provide an XmlNamespaceManager in the second parameter for
SelectSingleNode or SelectNodes. See the documentation for an example.

http://msdn.microsoft.com/library/en...asp?frame=true
--
Kirk Allen Evans
www.xmlandasp.net
Read my web log at http://weblogs.asp.net/kaevans
"suresh" <sm**@lucent.com> wrote in message
news:0e****************************@phx.gbl...
Thanx for the reply.

Looks like there is problem with the XPath queries, when
the xml document contains a default namspace. When i
remove the namespace completely for the root element all
my xpath queries work properly.

-----Original Message-----
"Navigator/SMDataSet/AntennaIdentifier"
or
"//AntennaIdentifier"

Chad

"suresh" <sm**@lucent.com> wrote in message
news:8c****************************@phx.gbl...
Hi,

I have the following xml file.

<Navigator xmlns="urn:uuid:721DCCFA-8250-4820-8C7D-
7AF0E52305FD">
<SMDataSet RegionName="NA" CustomerName="ATT"
MarketName="New Jersey" DataSetName="SMDS1"
Technology="CDMA" StartDateAndTime="2003-06-
01T00:00:00.0000000-04:00" EndDate="2003-06-
02T00:00:00.0000000-04:00" Duration="10" ECPVersion="1.0" >
<AntennaIdentifier CellNumber="1" AntennaNumber="1"
Azimuth="2" Latitude="54.45" Longitude="54.45">
<ServiceMeasurementMetric Name="mt1"
CapacityOfAverages="1.1"/>
</AntennaIdentifier>
<AntennaIdentifier CellNumber="1" AntennaNumber="2"
Azimuth="2" Latitude="54.45" Longitude="54.45">
<ServiceMeasurementMetric Name="mt1"
CapacityOfAverages="1.1"/>
</AntennaIdentifier>
<AntennaIdentifier CellNumber="2" AntennaNumber="1"
Azimuth="2" Latitude="54.45" Longitude="54.45"/>
<ServiceMeasurementMetric Name="mt1"
CapacityOfAverages="1.1"/>
<ServiceMeasurementMetric Name="mt2"
CapacityOfAverages="1.1"/>
</SMDataSet>
</Navigator>

Can some please tell me the Xpath query that should be
used in the selectNodes of DOMDocument that selects only
the AntennaIdentifier nodes under the SMDataSet node. In
entire doucment there will be only one SMDataSet node. I
am at the docuemnt node level.

Some how i am not able to make this work.

thank you
suresh

.

Nov 11 '05 #3

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

Similar topics

7
2769
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...
1
1716
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
1746
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
2168
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
4389
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...
1
3794
by: RKS | last post by:
Has anyone experienced a problem with the Sarissa implementation of selectNodes? My code, using the Sarissa parser, successfully loads an xml document into the domNode variable. The selectNodes...
8
12061
by: Vikram Vamshi | last post by:
If I execute XmlNode.SelectNodes("some xpath query") and then use foreach to iterate over it. Will it guaratee that the order of nodes I get will be same as the order of nodes in the original xml...
2
3210
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...
1
2422
by: Jazper | last post by:
hi i have a problem querying a simple atom-feed by xpath using the XmlDocument. i'm googleing for hours now and can't get a solution: --- Code --- XmlDocument doc = new XmlDocument();...
0
7225
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,...
0
7124
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
7385
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...
1
7046
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
7498
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...
0
5629
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,...
1
5053
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...
0
4707
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...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.