Read XML into VB6

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian Parker

    Read XML into VB6

    Hello all,

    I have been trying to find some information for reading XML files into
    VB6 but I'm somewhat confused by what is possible without getting onto
    VB.Net. Basically I have to read some really dumb XML data (ms office
    schema, just rows really) into my VB code. There must be a sensible
    way of doing it but I haven't found it yet.

    Any pointers (oops C joke) would be gratefully received.

    Cheers
    Brian
  • David

    #2
    Re: Read XML into VB6

    Brian Parker <brian at parker dot lu> wrote in message news:<o7rf90ppl 34lnqckci83e64c 5povg4jpoq@4ax. com>...[color=blue]
    > Hello all,
    >
    > I have been trying to find some information for reading XML files into
    > VB6 but I'm somewhat confused by what is possible without getting onto
    > VB.Net. Basically I have to read some really dumb XML data (ms office
    > schema, just rows really) into my VB code. There must be a sensible
    > way of doing it but I haven't found it yet.
    >
    > Any pointers (oops C joke) would be gratefully received.
    >
    > Cheers
    > Brian[/color]

    Hi Brian,
    Not exactly sure I know what you mean, but let me tell you what I
    am doing currently with VB6 and XML. My goal is to be able to open a
    recordset from a database and then pass that recordset via TCP/IP to a
    listening client. I have chosen to use WinSock for my method of
    passing the recordset. The problem was how to pass a recordset object
    via WinSock. To solve this, I am using a combination of XML and
    recordsets. I created a reference to Microsoft XML, v5.0 and to
    Microsoft ADODB. Then I have something like the following code

    Dim xmlRS As New MSXML2.DOMDocum ent50
    Dim db as New ADODB.Connectio n
    Dim rsTemp As New ADODB.Recordset
    dim strConnect as String

    strConnect = "Some valid connection string"

    db.CursorLocati on = adUseClient
    db.open strConnect,"adm in",""
    rsTemp.Open "Select * From
    tblClients",DB, adStatic,adRead Only,adCmdText
    set rsTemp.ActiveCo nnection = Nothing

    rsTemp.Save xmlRS, adPersistXML

    Winsock1.SendDa ta xmlRS.xml 'This now sends the recordset as an XML
    recordset

    ----------------------------------------------------------------------------
    On the other end, I have similar declarations and open the recordset
    as follows in the WinSock1.DataAr rival:

    dim strData as String
    Dim xmlRS As New MSXML2.DOMDocum ent50
    Dim rsTemp As New ADODB.Recordset

    WinSock1.GetDat a strData
    xmlRS.LoadXML strData
    rsTemp.Open xmlRS

    ----------------------------------------------------------------------------

    Additional resources that I use are the Wrox Press books, such as
    Professional Visual Basic 6 XML and VB6 Web Programming.

    Hope something here helps you out.

    David

    Comment

    Working...