Home All Groups Group Topic Archive Search About

reading a XML file to vb variables

Author
1 Jun 2005 3:11 PM
Peter Newman
im runninb vb6 sp6

im having to read a xml file from a third party to update our records and
need help

the xml file can hold any number of pynent details

<SubmissionResults xmlns="http://bacs.co.uk/submissions"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      submissionIdentifier="1117541180734CcTf5MW0i"
      status="complete"
      submissionType="fullTest"
      submissionSerialNumber="000045"
      submissionDateAndTime="Tue May 31 13:06:30 BST 2005"
      submissionEarliestDate="2005-06-01">





      <SubmittingServiceUser
      userNumber="B40107"
      name="A NAMED BUREAU LTD"/>

      <SubmittingContact contactIdentifier="NAME123456"
       fullName="MR ANY NAME" />

      <SigningContact contactIdentifier="NAME123456"
       fullName="MR ANY NAME"/>


          <PaymentFile status="complete"
           index="1"
           paymentFileIdentifier="001"

                  processingDay="2005-06-01"
                  currency="GBP"
                  creditRecordCount="0"
                  creditValueTotal="0"
                  debitRecordCount="0"
                  debitValueTotal="0"
                  ddiRecordCount="2"
                  workCode="1 DAILY  ">






        <OriginatingServiceUser userNumber="090909"
         name="A NAMED ENTERPRISE LIMITED"/>

       </PaymentFile>

          <PaymentFile status="complete"
           index="2"
           paymentFileIdentifier="001"

                  processingDay="2005-06-01"
                  currency="GBP"
                  creditRecordCount="0"
                  creditValueTotal="0"
                  debitRecordCount="19"
                  debitValueTotal="150984"
                  ddiRecordCount="0"
                  workCode="1 DAILY  ">




        <OriginatingServiceUser userNumber="121212"
         name="A PRIVATE COMPANY"/>

       </PaymentFile>

    </SubmissionResults>

has anybody any simple code that will read this and assign the values to
each section to variables ?

Author
1 Jun 2005 4:08 PM
Mike D Sutton
> im having to read a xml file from a third party to update our records and
> need help
>
> the xml file can hold any number of pynent details
<snip>
> has anybody any simple code that will read this and assign the values to
> each section to variables ?

Add a reference to the MSXML library and use that to parse the XML file, you can then use XPath to retrieve the data you
require from the document without having to parse any of it yourself.
Have a look at this old post and the links from it; should give you plenty of sample code for how to use the library,
then come back with any more specific questions.
Hope this helps,

    Mike


- Microsoft Visual Basic MVP -
E-Mail: ED***@mvps.org
WWW: Http://EDais.mvps.org/
Author
1 Jun 2005 7:32 PM
Jeff Johnson [MVP: VB]
"Mike D Sutton" <ED***@mvps.org> wrote in message
news:ec1loQsZFHA.3596@tk2msftngp13.phx.gbl...

> Have a look at this old post and the links from it; should give you plenty
> of
> sample code for how to use the library,

Uhh, WHAT old post?
Author
1 Jun 2005 7:48 PM
Zoury
I bet a twenty (canadian $ though... i'm no rich man <g>) he was talking
about this one :
http://groups.google.co.uk/group/microsoft.public.vb.general.discussion/msg/c8f73ad9971fd89

--
Best Regards
Yanick
Author
1 Jun 2005 8:00 PM
Mike D Sutton
> I bet a twenty (canadian $ though... i'm no rich man <g>) he was talking
> about this one :
> http://groups.google.co.uk/group/microsoft.public.vb.general.discussion/msg/c8f73ad9971fd89

D'oh..  Yes, indeed..  it's been a long day

    Mike


- Microsoft Visual Basic MVP -
E-Mail: ED***@mvps.org
WWW: Http://EDais.mvps.org/