Solved

How to parse an XML file with VB Scritp?

Posted on 2015-02-03
4
89 Views
Last Modified: 2015-02-05
I can generate an XML file, as attached.  I have given up on trying to do anything with the data stream as received, and instead am saving it to a .TXT file, which I need to open and then pull out the stuff I want with VB Script.  In the attached file, I need to capture the value of the APNMB field, then the date associated with each FWDAY field.  So output should look like this in the target file:

Application:  12345678
Date:  2011-05-06
Date:  2011-10-06
.
.
the rest of the date (FWDAY) fields until the end of the list.  I have found a few parsers on line, but they seem to be accessing a web site not a file; I didn't understand them anyway!
3D.txt
0
Comment
Question by:Mike Caldwell
  • 3
4 Comments
 
LVL 22

Accepted Solution

by:
plusone3055 earned 500 total points
Comment Utility
0
 
LVL 1

Author Comment

by:Mike Caldwell
Comment Utility
Great help 3055.  This works fine:

Set xmlDoc = _
  CreateObject("Microsoft.XMLDOM")

xmlDoc.Async = "False"
xmlDoc.Load("3D.txt")

Set colNodes=xmlDoc.selectNodes _
  ("//APNMB")

For Each objNode in colNodes
msgbox "Application: " & objnode.text
Next

Open in new window


 I can pull out APNMB or FWTYP, but having trouble still in two ways:  listing out the dates under one APNMB, then the FWTYPs under the next APNMB.
0
 
LVL 1

Author Comment

by:Mike Caldwell
Comment Utility
Correction: there should be a list of FWTYPs under each individual APNMB.
0
 
LVL 1

Author Closing Comment

by:Mike Caldwell
Comment Utility
Didn't get me all the way; I need to know how to deal with child nodes and their child nodes, but learned a lot and a good start.  I'm probably going to give up using VB Script for this.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now