XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
RE: [xml-dev] need help / insight on parsing some xml with vb6

Well, the web service you are trying to access:

https://api.competitionsuite.com/2013-02/Performances/?c=cce9ab64-5d54-44e4-a13e-f3b9528a5909

 

by default returns JSON instead of XML, but can also return XML with a bit more work.

 

You’ll need to send an additional HTTP Header to the Web Service. This function will do the job:

 

Function LoadXML(url As String)

   Dim oHttp As Object

    Set oHttp = CreateObject("MSXML2.XMLHTTP")

    oHttp.Open "GET", url, False

‘ Tell the web service to return XML instead of JSON

    oHttp.setRequestHeader "Accept", "text/xml"

    oHttp.send

 

    Set LoadXML = oHttp.responseXML

End Function

 

And then change the call to xmlObj.Load for:

 

Set objXML = LoadXML("https://api.competitionsuite.com/2013-02/Performances/?c=cce9ab64-5d54-44e4-a13e-f3b9528a5909")

 

 

 

De: Tom Martin [mailto:tomdmartin@gmail.com]
Enviado el: sábado, 14 de junio de 2014 6:07 p. m.
Para: William Velasquez
CC: Martin Honnen; xml-dev@lists.xml.org
Asunto: Re: [xml-dev] need help / insight on parsing some xml with vb6

 

Hey - this seems to be working...now I have another problem...

The source for the xml file is on a server and I am trying to load it but nothing happens.

Dim objXML As New MSXML2.DOMDocument

Dim NodeList As MSXML2.IXMLDOMNodeList

Dim xNode As MSXML2.IXMLDOMNode

 

objXML.async = False

  

Set NodeList = objXML.selectNodes("//ArrayOfCompetition/Competition/EventName")

 

For Each xNode In NodeList

    Combo1.AddItem xNode.Text

    List1.AddItem xNode.Text

Next

 

 

What am I missing? Can I use Microsoft Internet Transfer Control and save it out locally as an XML file? 

What is the best thing to do? This source xml will be updated regularly and I need to access it quickly and display results as soon as possible - speed is an issue.

Thoughts?

 

Tom

 

On Sat, Jun 14, 2014 at 6:20 PM, William Velasquez <wvelasquez@visiontecnologica.com> wrote:

Sorry the correct type for Nodelist is XMLDOMNodeList

 

 

 

 

Enviado desde Samsung Mobile de Claro, perdón por lo escueto.


-------- Mensaje original --------
De: Tom Martin <tomdmartin@gmail.com>
Fecha: 14/06/2014 9:18 AM (GMT-05:00)
A: Martin Honnen <Martin.Honnen@gmx.de>
CC: xml-dev@lists.xml.org
Asunto: Re: [xml-dev] 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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS