Results 1 to 2 of 2

Thread: ASP & XML

  1. #1

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188

    ASP & XML

    Hey All

    Im just learning all of this and im stuck when trying to use an XML file in ASP.

    My XML File looks like this

    Quote -

    <?xml version="1.0" encoding="utf-8" ?>
    - <rsp stat="ok">
    - <photoset id="1651651651" primary="169818116951">
    <photo id="51651" secret="651651" server="49" title="a title" isprimary="0" />
    <photo id="561651" secret="16516198" server="54" title="another title" isprimary="1" />
    </photoset>
    </rsp>



    How do i get the "ID" portion of the photo tag into an ASP Variable?


    thanks for any help
    b

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: ASP & XML

    Beacon? Beacon! How long has it been?

    VB Code:
    1. set oXML = Server.CreateObject("Microsoft.XMLDOM")
    2.     oXML.Load("Your xml file")
    3.     oXML.setProperty "SelectionLanguage", "XPath"
    4.     set oXMLNodes = oXML.SelectNodes("/rsp/photoset/photo/@id")

    Note that since there are two photo tags, you'll get two values returned, so you need to loop through oXMLNodes.

    Now come over to chit chat and say hello to people who don't know you.

Posting Permissions

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



Click Here to Expand Forum to Full Width