473,398 Members | 2,389 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,398 software developers and data experts.

How to get needed data from XML document

Hello.

Using VS.NET 2003(VB), .NET Framework 1.1.4322, ASP.NET 1.1.4322, WSE2.0 on
a WinXP Pro Sp2 computer.

I need help trying to extract the "TruckName" data from this XML document
(at the end of this request). I want the data after the equal(=) sign. The
data is the InnerXml and the OuterXml

I tried using this code, but it never executes the For Each loop.

Dim Trucks As XmlDocument =
GetList(XataNetConduitWebService.ClassType.Truck, orgID)
Dim truck As XmlNode
Dim nodeList As XmlNodeList
Dim root As XmlNode = Trucks.DocumentElement
nodeList = root.SelectNodes("//TruckName")
For Each truck In nodeList
Me.txtNodeInfo.Text = Me.txtNodeInfo.Text & truck.Value
Next

Any help would be gratefully appreciated.

Thanks,
Tony

<TruckConduitDataObject><Truck XVIN="67111377" TruckName="243101"
OrganizationID="1212" OrganizationName="KTC Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true"
Odo="292488.5" OdoAsOf="2006-06-26T20:48:00.0000000-05:00"
FormattedDateTime="06/26/06 04:48p" Axles="3" Berth="false"
HasOnBoardPlatform="true" HasDIU="true" /><Truck XVIN="67112645"
TruckName="447858" OrganizationID="1213" OrganizationName="Croydon Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true" Odo="82045.6"
OdoAsOf="2006-06-26T19:06:00.0000000-05:00" FormattedDateTime="06/26/06
03:06p" Axles="3" Berth="false" HasOnBoardPlatform="true" HasDIU="true"
/><Truck XVIN="67112646" TruckName="447857" OrganizationID="1213"
OrganizationName="Croydon Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true"
Odo="358688.3" OdoAsOf="2006-06-26T20:35:00.0000000-05:00"
FormattedDateTime="06/26/06 04:35p" Axles="3" Berth="false"
HasOnBoardPlatform="true" HasDIU="true" /><Truck XVIN="67112656"
TruckName="302" OrganizationID="1212" OrganizationName="KTC Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true"
Odo="203206.9" OdoAsOf="2006-06-26T19:01:00.0000000-05:00"
FormattedDateTime="06/26/06 03:01p" Axles="3" Berth="false"
HasOnBoardPlatform="true" HasDIU="true" /><Truck XVIN="67112657"
TruckName="287095" OrganizationID="1212" OrganizationName="KTC Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true" Odo="167641"
OdoAsOf="2006-06-26T04:00:00.0000000-05:00" FormattedDateTime="06/26/06
12:00a" Axles="3" Berth="false" HasOnBoardPlatform="true" HasDIU="true"
/></TruckConduitDataObject>

<TruckConduitDataObject><Truck XVIN="67111377" TruckName="243101"
OrganizationID="1212" OrganizationName="KTC Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true"
Odo="292488.5" OdoAsOf="2006-06-26T20:48:00.0000000-05:00"
FormattedDateTime="06/26/06 04:48p" Axles="3" Berth="false"
HasOnBoardPlatform="true" HasDIU="true" /><Truck XVIN="67112645"
TruckName="447858" OrganizationID="1213" OrganizationName="Croydon Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true" Odo="82045.6"
OdoAsOf="2006-06-26T19:06:00.0000000-05:00" FormattedDateTime="06/26/06
03:06p" Axles="3" Berth="false" HasOnBoardPlatform="true" HasDIU="true"
/><Truck XVIN="67112646" TruckName="447857" OrganizationID="1213"
OrganizationName="Croydon Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true"
Odo="358688.3" OdoAsOf="2006-06-26T20:35:00.0000000-05:00"
FormattedDateTime="06/26/06 04:35p" Axles="3" Berth="false"
HasOnBoardPlatform="true" HasDIU="true" /><Truck XVIN="67112656"
TruckName="302" OrganizationID="1212" OrganizationName="KTC Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true"
Odo="203206.9" OdoAsOf="2006-06-26T19:01:00.0000000-05:00"
FormattedDateTime="06/26/06 03:01p" Axles="3" Berth="false"
HasOnBoardPlatform="true" HasDIU="true" /><Truck XVIN="67112657"
TruckName="287095" OrganizationID="1212" OrganizationName="KTC Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true" Odo="167641"
OdoAsOf="2006-06-26T04:00:00.0000000-05:00" FormattedDateTime="06/26/06
12:00a" Axles="3" Berth="false" HasOnBoardPlatform="true" HasDIU="true"
/></TruckConduitDataObject>
Jun 26 '06 #1
2 1185
RJ
Looks to me like your document element ( root element ) is
TruckConduitDataObject...
If this is true, don't you want to get the Truck nodes first, then get the
TruckName attribute from each Truck node?
"Tony Girgenti" <To**********@discussions.microsoft.com> wrote in message
news:F1**********************************@microsof t.com...
Hello.

Using VS.NET 2003(VB), .NET Framework 1.1.4322, ASP.NET 1.1.4322, WSE2.0
on
a WinXP Pro Sp2 computer.

I need help trying to extract the "TruckName" data from this XML document
(at the end of this request). I want the data after the equal(=) sign.
The
data is the InnerXml and the OuterXml

I tried using this code, but it never executes the For Each loop.

Dim Trucks As XmlDocument =
GetList(XataNetConduitWebService.ClassType.Truck, orgID)
Dim truck As XmlNode
Dim nodeList As XmlNodeList
Dim root As XmlNode = Trucks.DocumentElement
nodeList = root.SelectNodes("//TruckName")
For Each truck In nodeList
Me.txtNodeInfo.Text = Me.txtNodeInfo.Text & truck.Value
Next

Any help would be gratefully appreciated.

Thanks,
Tony

<TruckConduitDataObject><Truck XVIN="67111377" TruckName="243101"
OrganizationID="1212" OrganizationName="KTC Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true"
Odo="292488.5" OdoAsOf="2006-06-26T20:48:00.0000000-05:00"
FormattedDateTime="06/26/06 04:48p" Axles="3" Berth="false"
HasOnBoardPlatform="true" HasDIU="true" /><Truck XVIN="67112645"
TruckName="447858" OrganizationID="1213" OrganizationName="Croydon Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true"
Odo="82045.6"
OdoAsOf="2006-06-26T19:06:00.0000000-05:00" FormattedDateTime="06/26/06
03:06p" Axles="3" Berth="false" HasOnBoardPlatform="true" HasDIU="true"
/><Truck XVIN="67112646" TruckName="447857" OrganizationID="1213"
OrganizationName="Croydon Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true"
Odo="358688.3" OdoAsOf="2006-06-26T20:35:00.0000000-05:00"
FormattedDateTime="06/26/06 04:35p" Axles="3" Berth="false"
HasOnBoardPlatform="true" HasDIU="true" /><Truck XVIN="67112656"
TruckName="302" OrganizationID="1212" OrganizationName="KTC Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true"
Odo="203206.9" OdoAsOf="2006-06-26T19:01:00.0000000-05:00"
FormattedDateTime="06/26/06 03:01p" Axles="3" Berth="false"
HasOnBoardPlatform="true" HasDIU="true" /><Truck XVIN="67112657"
TruckName="287095" OrganizationID="1212" OrganizationName="KTC Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true"
Odo="167641"
OdoAsOf="2006-06-26T04:00:00.0000000-05:00" FormattedDateTime="06/26/06
12:00a" Axles="3" Berth="false" HasOnBoardPlatform="true" HasDIU="true"
/></TruckConduitDataObject>

<TruckConduitDataObject><Truck XVIN="67111377" TruckName="243101"
OrganizationID="1212" OrganizationName="KTC Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true"
Odo="292488.5" OdoAsOf="2006-06-26T20:48:00.0000000-05:00"
FormattedDateTime="06/26/06 04:48p" Axles="3" Berth="false"
HasOnBoardPlatform="true" HasDIU="true" /><Truck XVIN="67112645"
TruckName="447858" OrganizationID="1213" OrganizationName="Croydon Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true"
Odo="82045.6"
OdoAsOf="2006-06-26T19:06:00.0000000-05:00" FormattedDateTime="06/26/06
03:06p" Axles="3" Berth="false" HasOnBoardPlatform="true" HasDIU="true"
/><Truck XVIN="67112646" TruckName="447857" OrganizationID="1213"
OrganizationName="Croydon Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true"
Odo="358688.3" OdoAsOf="2006-06-26T20:35:00.0000000-05:00"
FormattedDateTime="06/26/06 04:35p" Axles="3" Berth="false"
HasOnBoardPlatform="true" HasDIU="true" /><Truck XVIN="67112656"
TruckName="302" OrganizationID="1212" OrganizationName="KTC Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true"
Odo="203206.9" OdoAsOf="2006-06-26T19:01:00.0000000-05:00"
FormattedDateTime="06/26/06 03:01p" Axles="3" Berth="false"
HasOnBoardPlatform="true" HasDIU="true" /><Truck XVIN="67112657"
TruckName="287095" OrganizationID="1212" OrganizationName="KTC Bulk"
DateOfQuery="2006-06-26T22:25:20.5770000-05:00" IsActive="true"
Odo="167641"
OdoAsOf="2006-06-26T04:00:00.0000000-05:00" FormattedDateTime="06/26/06
12:00a" Axles="3" Berth="false" HasOnBoardPlatform="true" HasDIU="true"
/></TruckConduitDataObject>

Jun 27 '06 #2


Tony Girgenti wrote:

I need help trying to extract the "TruckName" data from this XML document
(at the end of this request). I want the data after the equal(=) sign. The
data is the InnerXml and the OuterXml <TruckConduitDataObject><Truck XVIN="67111377" TruckName="243101"

^^^^^^^^^^^^^^^^^
That one? That is an attribute of the Truck element, so you need e.g.

For Each TruckName in
xmlDocument.SelectNodes("TruckConduitDataObject/Truck/@TruckName")
' use TruckName.Value here to access e.g. 243101
Next


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Jun 27 '06 #3

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

Similar topics

8
by: Wolfgang Lipp | last post by:
<annotation> the first eleven contributions in this thread started as an off-list email discussion; i have posted them here with the consent of their authors. -- _w.lipp </annotation> From:...
4
by: Ringo Langly | last post by:
Hi all, I'm a seasoned web programmer, but I've never touched XSLT. It's always been one of those acronyms I've never needed to educate myself on. Now... we're working with a web content...
3
by: % =joe % | last post by:
I cannot get this code to work. Very simple...I have three list menus. I want to do a check before the form submits to make sure that the value of the 3 fields is equal to 12. Here's my...
6
by: xenophon | last post by:
I have a grid with checkboxes in it. When a checkbox is un/checked, I want to set a true-false value in an array. Then on PostBack I can work with that array. I know I need to use...
28
by: Ian Davies | last post by:
Hello I would appreciate some help from someone who has knowledge of working with css, php javascript and how they interact. Ive been working on a task for the last few days and have started to...
2
AHayes
by: AHayes | last post by:
This is actually my first post, so please forgive any forum "no-nos" in this post. _The Background For a work project, I need to port an ASP.Net (C#) search application to a SharePoint webpart....
13
by: DDragon | last post by:
ok here is the problem, i have to forms which have values i wish to be added together i can add together the values in one form all right but im having problems with adding the values of the other...
1
by: sarah12 | last post by:
HI, This time , I need to write the XSL to transform the following document : <?xml version="1.0"?> <nplbiblio rundate="20080110"> <document status="U" creadate="19990410">...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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...

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.