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>
0
6/26/2006 10:40:02 PM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
694 Views

Similar Articles

[PageSpeed] 23

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" <TonyGirgenti@discussions.microsoft.com> wrote in message 
news:F115FB5F-A273-4607-AB47-AA90CE75373C@microsoft.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> 


0
postonly1 (3)
6/27/2006 12:41:18 PM

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/
0
mahotrash (1778)
6/27/2006 12:52:07 PM
Reply:

Similar Artilces:

Crystal Report Writer Needed for Central Florida Assignment
A Central Florida client has about 300 Crystal reports that need to be modified in the next 3-4 weeks. We are looking for a consultant that can be onsite to work with the clients for testing and approval. If interested, email a brief resume on you, availability information, and rate requirements to me at rwhaley@ibgnet.com -- Richard L. Whaley Author / Consultant / MVP 2006-2008 Documentation for Software Users Get our Free Tips and Tricks Newsletter and check out our books at http://www.AccoladePublications.com ...

i get error 404 not found when trying to download
I'm trying to download nokia pc suite to windows xp to upload gallery onto the computer but get error message404 not found - how can i download this pc suite please -- Krysy Albutt Krysy Albutt wrote: > I'm trying to download nokia pc suite to windows xp to upload gallery > onto the computer but get error message404 not found - how can i > download this pc suite please Care to enlighten us how this pertains to: - 1) Microsoft 2) Publisher 3) Windows If you're having problems downloading from the *NOKIA* site where do you think you should be directing your ...

need to put a condition to run macro
Hello I have the following macro assigned to a button. I wanted to modify the same to do the following. I need to run this macro only if the value in C66=2 When I am running this macro, it paste the value '1' in C66. So If click the button again it will not run unless the value change to 2 Hope someone help me. Thanks Toms Public Sub CopyValues() With Range("M" & Rows.Count).End(xlUp).Offset(1, 0) .Value = .Offset(-1, 0).Value + 1 .Offset(0, 1).Resize(1, 2).Value = Range("p1:q1").Value Range("b5").Value = .Value End With Range("C66"...

OT
Slightly off topic - counldn't find any appropriate group on my server. I'm running a prog in debug mode (VC7.1.3088) for several hours or more and I'm sending a lot of output via ATLTRACE2 to the output window. In the past I've had a couple visual studio crashes and I wondered if there was any restriction on the amount of data the output window can safely take - or there are any bugs linked to this. TIA "Joe" <not@here.com> wrote in message news:4230fa32$0$10953$cc9e4d1f@news-text.dial.pipex.com... > Slightly off topic - counldn't find any appr...

Q: How to automatically adapt column width with XML format?
Hi. I'm developing an application that outputs its results to an XML file (with Excel XP's DTD). The trouble is the column width, which is set at default. Is there an XML tag which allow to adapt width automatically? I thought about a VBA macro, but I noticed that VBA code isn't stored in XML Excel's files. Thanks in advance, Francesco. ...

How to get Calendar to send me reminders
I have changed my e-mail address but for some reason I cannot get Calendar to send reminders to my new address - I think I have carried out all that is necessary to effect the changover but I am not getting reminders sent. Can anyone help please? Is the Calendar Live ID based and accessible at Calendar.live.com ? -- ....winston ms-mvp mail "Dabardevon" wrote in message = news:FDC2B3B2-EDE4-41B1-BFC4-C0F9ED59CFB9@microsoft.com... I have changed my e-mail address but for some reason I cannot get = Calendar to send reminders to my new address - I think I have...

need a date look here
This is a multi-part message in MIME format --=_NextPart_2rfkindysadvnqw3nerasdf Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Get all the hots girls @ www.pearlymae.com --=_NextPart_2rfkindysadvnqw3nerasdf Content-Type: text/html Content-Transfer-Encoding: quoted-printable <html> <head> <meta name=3D"GENERATOR" content=3D"Microsoft FrontPage 6.0"> <meta name=3D"ProgId" content=3D"FrontPage.Editor.Document"> <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dwindow...

Some recipients get the attachment, some get winmail.dat
This one has me baffled. We are using Exchange 2000 and Outlook 2000 and have been for 8 months. No previous problems with attachments (.doc, .xls, .jpg). About 2 weeks ago, we started hearing from certain recipients that the attachment wasn't arriving; instead they were getting an unreadable file called winmail.dat. MS says that this is because the sender is using Rich Text to format the email. We have changed the senders to use Plain Text and still have the same problem. If the email is sent to several recipients, some will get the attachment fine, some will not. This didn'...

How to get the CScrollBar's Handle in CTreeCtrl?
Hey,All: I thought I have a problem when I trid to get the CScrollBar's handle from my CTreeCtrl extended handle. Can anybody tell me whether I can get the handle of the CScrollBar from the CTreeCtrl? Thanks in advance! Carl :-| Carl wrote: > Hey,All: > > I thought I have a problem when I trid to get the CScrollBar's handle from > my CTreeCtrl extended handle. > Can anybody tell me whether I can get the handle of the CScrollBar from the > CTreeCtrl? > > Thanks in advance! > Carl > :-| > > Sorry, it is not that simple. The scroll bars that...

Keeping data without losing Formula's
I have a worksheet (named monthly) with a column of data under a certain month (which will change each time data is entered - stocktake). However this column needs to be edited each month and has formula's in it so it will work (not always the same data in the column). I decided to put this data into a yearly sheet under the particular month. The only way I can do it at the moment is to copy and paste special. How do I (or is there a way to) put this data in a sheet that has all the months but under the month that is signified. In other words I don't want formula's in the yearl...

A Crystal Beginner
I am using Crystal 9.2.4.77 and have loaded the Crystal enhancements. Now I want to do against the CRM database. What do I do? I thought I would create a data source to the CRM SQLserver, which I did, then connect to it through Crystal Reports. That works, but when I drill down on the AAA_MSCRM database to choose my tables, it shows me dbo as the only option (where did this come from??) and under that are just a few generic tables. No CRM tables. Something's not quite right. What am I missing? file - log on to aps server "KBLawson" <klawson@aetinc.com> wrote in ...

Restrict spreadsheet to data entry only
Fairly new to Excel. Once I've set up the structure of my spreadsheet, and entered the formulae for calculated cells etc, how can I ensure that the spreadsheet is used just for data entry and that the structure cannot be altered in any way? TIA You can use protection. You need to go to every cell you want for data entry and unprotect tha cell. You can select multiple cells... right mouse click... Then hi format cells... The last tab says protection, select it and click th check box to unprotect these items. Now you can then in the menu bar hit Tools... Protection... and the Protect...

Static Range, Dynamic Chart Data
I have read some great tips on making my chart dynamic that involv changing the range. The chart I would like to create is a 12 month lin chart. I want the chart to always be 12 months in length, but the poin to simply not be plotted if the value of the cell "blank". In othe words, stop the line short of the end of the plot area. The 12 months of charted cells have a formula lik =IF(A1=0,"",SUM(A1:A6)). So you see a blank cell if A1 is 0. But th chart shows this as a zero value. If I delete the contents the char does what I would like. Is there a way to simply change the ...

Cannot get fast forward or fast reverse to work with WMP 11
I am running Vista Home Premium on a HP G 217-EM Notebook which comes pre-installed with Windows Media Player 11. When I play cds and try to fast forward or fast reverse by keeping the fast forward or fast reverse buttons constantly depressed nothing happens. Why is this, and can anyone come up with a solution? Many thanks This doesn't work on my system either, so it's probably just a limitation of WMP. Fast forward and fast reverse should work fine when you rip the CD's to MP3 or WMA files, and play these files instead. Regards -- Tim De Baets http://www....

Excel VBA / Data Sorting / Maniputaltion
i have a long list, which i imported from other data base. The problem is: 1. In each cell, besides data (data is in alphabates) there are som numeric characters which i dont want . How can i get rid of all those unwanted numbers from data, from all th list? 2. The data is in every second row, ie. one row is empty. How can i Delete those empty/blank rows from the list -- Message posted from http://www.ExcelForum.com 1. I think we will need to see a sample of your data 2. Sort the data -- Message posted from http://www.ExcelForum.com I am sending the sample data file... ...

Get paid while you get online!!
I found a great Internet company - Cashfiesta.com - that has created a product everyone can benefit from. They pay you while you work or play on your computer. All you need to do is keep their software - the FiestaBar=99 - active while you are online. They even pay you when your friends are using their computers. Unlike other companies, Cashfiesta gives you control over how much money you earn. They have an individual payrate based on the number of Special Offers you sign up for. As some of these offers are free, you can increase your payrate up to 33 times without spending a penny. It's...

Help needed #7
Please Help me in the following :: For Example in Cell A1 I write (15860) Rupees '''Rupees is Pakistani Currency' now it should be divided into parts as under:::> A2 >> [heading is Thousands] > 15 A3 >> [heading is Five Hundreds] > 01 A4 >> [heading is Hundreds] > 03 A5 >> [heading is Fifty] > 01 A6 >> [heading is Tens] > 01 in this example the amount has been divided into parts that it has 15-notes of Tho...

help reading xml doc
I'm new to XML, so please bear with me. I'm using XPathNavigator and XPathNodeIterator to return a set of xml nodes from a document that looks like this: <root> <book title="Some Title"> <chapter> <title>Chapter 1</title> <starting_page>34</starting_page> <number_of_pages>15</number_of_pages> </chapter> <chapter> <title>Chapter 2</title> <starting_page>50</starting_page> <number_of_pages>15</number_of_pa...

Can't get auto-update (update) to install
Version: 2008 Operating System: Mac OS X 10.4 (Tiger) Processor: Power PC I've been trying to manually check for updates to Word 2008, and I get a &quot;critical update&quot; notice, asking me to install auto-update. When I try to install it, I cannot. It just keeps repeating the attempt, in an &quot;endless loop.&quot; What to do? <br> Thank you. ...

Spreadsheet getting corrupted
Hello All: I have a relatively large spreadsheet. I am getting errors (see after my signature line). What could be causing these errors? Is it that the spreadsheet is too large? Thanks Deguza -------------------------------------------------------- Microsoft Office Excel File Repair Log Errors were detected in file 'C:\Documents and Settings\deguza\My Documents\sales\Sales_2006_2007.xls' The following is a list of repairs: Global PivotTable report information was repaired due to integrity problems. Global PivotTable report information was repaired due to integrity problems. Glo...

xml schemalocation
I'm trying to generate a schemalocation entry on my root node when using the xmlserializer.serialize method. I have been unable to achieve this. Is there a certain attribute I need to be applying to my root node class for that to appear? Any help is appreciated. Lance Johnson How about: public class Test { [XmlAttribute("schemalocation")] public string Location; } "Lance Johnson" <ljohnson@docs.com> wrote in message news:ud$OUCzsFHA.2076@TK2MSFTNGP14.phx.gbl... > I'm trying to generate a schemalocation entry on my root node when using the &...

i need to do a restaurant menu
can i get an out line of a restaurant menu ilia, You have posted your question to the Microsoft Access, database software, newsgroup. Scroll a wee bit further down in the Microsoft interface and look for Word or Publisher. However, since you mention you are looking for a templates, see... http://office.microsoft.com/en-us/templates/FX100595491033.aspx For menu templates see... http://office.microsoft.com/en-us/templates/results.aspx?qu=menu&av=TPL000 -- Gina Whipp 2010 Microsoft MVP (Access) "I feel I have been denied critical, need to know, information!...

Reg getting the next IV Document Number field !
Hi, I am creating a window in dexterity similar to the item transaction entry window (Transactions>Inventory> Transaction Entry). In the Item transaction Entry window, the Document number field defaults to the next document number when we move the focus to that field. I wanted to know if there is any function , or table that i can access to get the next document number in the new window that i am creating. Thanks, swetha -- swetha >In the Item transaction Entry window, the Document number field defaults to the next document number when we move the focus to that field.< T...

Need to change data entered into cell. HELP ASAP!!
I have a list of over 7000 unique numbers (i.e. 123 or 77- 123). I need to add the letters "MH" in front of each number. Is there an easier way to do this than to click and edit each individual cell manually? Please help, anyone have any suggestions? Lots of thanks in advance. Hi one way (if you only have numbers): use acustom format : "MH"0 another way: in the adjacent column in row one (lets say in B1) enter the formula ="MH" & A1 copy this formula down After this select column B and copy the contents (CTRL+C). goto 'Edit - Paste Special' a...

How to export fixed length records to a data file.
I'm creating a query for our school using the school district's standard student data format. All fields are fixed width. For example the WhiteEthnicFg field is exactly one character of either "Y" or "N". In our database we record that field as a Boolean. The Date-of-Birth District's field is an 8 character field in the format mmddyyyy. Most fields are fixed width 'Char' fields, but I don't know how to make the output match the correct width. There are decimal fields 'with one implied decimal point'. Example: 0000100 will result ...