Results 1 to 6 of 6

Thread: XML (XP)

  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    XML (XP)

    In the following example I can get the text of child nodes with -
    varData = xmlDoc1.Childnodes(i).Text
    However, I can't figure out how to get the value set in a parent node - for example - the Meeting ID in - <Meeting ID="1037694"> or the Event ID in <Event ID="1037694_01"> the text property seems to return the text from all of the nodes children
    - <Data>
    - <GetMeetingsAll>
    - <Meeting ID="1037694">
    <Venue>ASCOT</Venue>
    <Type>R</Type>
    <Events>9</Events>
    <Track>GOOD</Track>
    <TrackRtg>3</TrackRtg>
    - <Event ID="1037694_01">

    I tried .attributes("ID) and a variety of alternatives but I just cant find the right syntax

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: XML (XP)

    XML generation in Access 2002 can be a challenge - I've only done a little with it, and it seems the most effective way to do it is to export individual tables as separate documents. If I try to export it in a single document it generates far more data than I want. I believe that 2003 and 2007 do a much better job of this, but haven't worked on it with either of those versions.
    Wendell

  3. #3
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: XML (XP)

    Thanks Wendall, I finally worked it out (ie I found an example in another procdure I wrote some time ago) -

    strEventID = xmlDoc1.childnodes(intCount1).getAttribute("ID")

    I was thinking that I should be looking for a property in the Attributes collection but instead it seems that I need to use a method 'GetAttribute' though I still think this is counter intuitive.

    I get this XML from a website by passing it a path and method, then parse the XML returned into my tables.

    "The answer to every software question is logical - given hindsight."

  4. #4
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: XML (XP)

    Hi Kent, can you please post the procedure(s) containing the code that allows you to "to get the value set in a parent node" and to "get this XML from a website by passing it a path and method, then parse the XML returned into my tables."
    ?

  5. #5
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    Brisbane, Queensland, Australia
    Posts
    387
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: XML (XP)

    Here is a zip with a screen shot of the XML Sample and an MDB with the code.
    Obviously you can't actually use the code, 'cause you won't have a session ID but you should be able to get a good idea of how it all works.
    Attached Files Attached Files

  6. #6
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: XML (XP)

    Thank you Kent <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •