Visual Basic 6 Accessing XML database on a web server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel Sullivan

    Visual Basic 6 Accessing XML database on a web server

    Hi, I was wondering if someone could help me to use visual basic 6 to
    connect to a server with a XML file on it and retrieve certain parts. I'm a
    bit of a newbie in XML programming, so any help would be greatly
    appreciated.
    Thanks,
    Daniel Sullivan



  • Finlay

    #2
    Re: Visual Basic 6 Accessing XML database on a web server

    Hi Daniel,

    This should get you the xml from your server down into a DOM document.
    They are used to process xml in a node tree. Look up XPath as a
    means of jumping to nodes directly. http://www.w3schools.com/ has
    good resources on this and other xml style things. Look up DOM on
    MSDN and you should get the hang of it quite quickly. It is a simple
    technology.

    You'll need to add Microsoft XML, 3.0 into your references for the vb
    project. This requires a reasonably up to date version of IE or a
    seperate install of MSXML.

    Regards,

    Finlay Macrae

    Dim obj As New DOMDocument
    Dim bstrString As String
    Dim objXMLHTTPReque st As New MSXML2.XMLHTTP

    objXMLHTTPReque st.open "GET", "http://yourserver/your .xml or .asp",
    False
    objXMLHTTPReque st.setRequestHe ader "Content-type", "text/xml"
    objXMLHTTPReque st.send
    If objXMLHTTPReque st.Status = 200 Then
    bstrString = objXMLHTTPReque st.responseText
    Else
    MsgBox "Problem with download :("
    End If

    obj.loadXML bstrString
    MsgBox obj.xml


    "Daniel Sullivan" <danielsullivan 87@bigpond.com> wrote in message news:<kz4Ta.794 8$OM3.2893@news-server.bigpond. net.au>...[color=blue]
    > Hi, I was wondering if someone could help me to use visual basic 6 to
    > connect to a server with a XML file on it and retrieve certain parts. I'm a
    > bit of a newbie in XML programming, so any help would be greatly
    > appreciated.
    > Thanks,
    > Daniel Sullivan[/color]

    Comment

    Working...