?
Solved

How to parse an XML file with VB Scritp?

Posted on 2015-02-03
4
Medium Priority
?
95 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 22

Accepted Solution

by:
plusone3055 earned 2000 total points
ID: 40588502
0
 
LVL 1

Author Comment

by:Mike Caldwell
ID: 40588850
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
ID: 40589337
Correction: there should be a list of FWTYPs under each individual APNMB.
0
 
LVL 1

Author Closing Comment

by:Mike Caldwell
ID: 40592711
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

Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

741 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