Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Nottingham, UK, Nottinghamshire, England
    Posts
    190
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Reading XML with VBScript

    Can anyone tell me how to read an XML data file with VBscript? I have an XML file of the format
    <paststories>
    <story>
    <storyref>someref</storyref>
    <storytitle>sometitle</storytitle>
    <storydate>somedate</storydate>
    </story>
    .
    .
    .
    </paststories>

    Now I want to use VBScript scripts in an ASP file to read that XML file and then use the data to format a table. So in some way, I want to derive VB variables, say, strRef, strTitle, strDate, and populate a table by coding <tr><td><%=strTitle %></td><td><%=strDate %></td></tr> for each <story> in the XML file.

    My problem is that I can't find a method that works. I've tried XMLRead which looked promising, but I couldn't find a way of getting the page to display in any way! I must be doing something wrong! Can anyone provide me with all that I need to code round what I've put here? Or am I mistaken that this can actually be achieved? I'm aware that I can use simple XML to achieve what I want EXCEPT for the href value - that's what's driving me crazy! Thanks in advance.

  2. #2
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reading XML with VBScript

    I might have a solution for you -- I have a 'proof of concept' set of pages that can take an XML datafile and output it to a sortable HTML table. The code is a little much to post here, but the nut seems to be involved in this snippet:

    document.all("tbl").innerHTML = proc.output
    elseif el.id = "optRemove" then
    set proc = TemplateNoDups.createProcessor
    proc.input = xml
    proc.transform
    s = proc.output
    set xml = createObject("msxml2.DOMDocument")
    xml.async=false
    xml.loadXML s
    set proc = Template.createprocessor
    proc.input = xml
    proc.transform
    document.all("tbl").innerHTML = proc.output

    which uses ("tbl").innerHTML

    If you're interested I can send you the concept pages and you can wack around with it...I got this from an article that will give you all the details, but it's a little skimply on the output to table in and of itself.

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Reading XML with VBScript

    I posted in your other thread, <post#=453074>post 453074</post#>.

Posting Permissions

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