[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: need help / insight on parsing some xml with vb6

  • From: Tom Martin <tomdmartin@gmail.com>
  • To: Martin Honnen <Martin.Honnen@gmx.de>
  • Date: Sat, 14 Jun 2014 10:16:01 -0400

Re:  need help / insight on parsing some xml with vb6
Hey - thanks - that got me past one error now I have another....

Private Sub Command1_Click()
Dim objXML As New MSXML2.DOMDocument
Dim NodeList As MSXML2.IXMLDOMNode
Dim xNode As MSXML2.IXMLDOMNode

objXML.async = False
objXML.Load ("C:\Documents and Settings\Tom\Desktop\new xml test aop.xml")
 
Set NodeList = objXML.selectNodes("//ArrayOfCompetition/Competition/EventName")
 
For Each xNode In NodeList
    Print xNode.Text
Next
End Sub


The error I now get is Type Mismatch on this line: 
Set NodeList = objXML.selectNodes("//ArrayOfCompetition/Competition/EventName")


Here is a snippet of the xml from the beginning....

  <?xml version="1.0" encoding="utf-8" ?>
- <Competition>
  <ChiefJudge />
  <CompetitionGuid>72a399f8-480c-4743-9c14-4357a77582ce</CompetitionGuid>
  <CompetitionName />
  <Date>2014-06-26T09:00:00</Date>
  <EventName>Southwest Corps Connection</EventName>
  <GroupTypeID>4</GroupTypeID>
  <IsCurrentSeason>true</IsCurrentSeason>
  <Location>Mesa AZ</Location>
  <OrgCompetitionID>0</OrgCompetitionID>
  <RecapReleased>false</RecapReleased>
  <SeasonGuid>348fac28-d10c-47e5-8753-802512df9904</SeasonGuid>
  <SeasonName>2014</SeasonName>
  </Competition>
- <Competition>
  <ChiefJudge />
  <CompetitionGuid>20c36756-adf0-47f8-8edb-30db18b6dbb6</CompetitionGuid>
  <CompetitionName />
  <Date>2014-06-25T09:00:00</Date>
  <EventName>Drums on the Ohio</EventName>
  <GroupTypeID>4</GroupTypeID>
  <IsCurrentSeason>true</IsCurrentSeason>
  <Location>Evansville IN</Location>
  <OrgCompetitionID>0</OrgCompetitionID>
  <RecapReleased>false</RecapReleased>
  <SeasonGuid>348fac28-d10c-47e5-8753-802512df9904</SeasonGuid>
  <SeasonName>2014</SeasonName>
  </Competition>
........


Thoughts?

Tom


On Sat, Jun 14, 2014 at 5:08 AM, Martin Honnen <Martin.Honnen@gmx.de> wrote:
Tom Martin wrote:

The code that you provided was helpful and here is what I did attached
to a button click...

Dim objXML As New MSXML2.DOMDocument
Dim NodeList As MSXML2.IXMLDOMNode
  Dim xNode As MSXML2.IXMLDOMNode

objXML.async = False
objXML.Load ("C:\Documents and Settings\Tom\Desktop\new xml test aop.xml")
'objXML.Load ("c:\users\BillGates\Documents\competition.xml")
Set NodeList =
objXML.selectSingleNode("/ArrayOfCompetition/Competition/EventName")

The code posted by William used
  selectNodes
and not
  selectSingleNode
Only selectNodes gives you a NodeList you can iterate over, selectSingleNode returns the first matched node or Nothing if none is found.





[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.