Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP XML Using ASP 3 and XML. See also the XML category for more XML discussions not relating to ASP. NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 14th, 2004, 10:38 AM
Registered User
 
Join Date: Apr 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Converting an XML data island to 2 arrays

I'm using the following setup.

I've an ASP page that returns XML from an SQL query

<%
Response.ContentType = "text/xml"
...

...
oRS.Save Response, 1
...

%>

This returns beautiful XML in IE6. The data is 2 columns - ReportDate and Value. No problems here. I've a VB6 app which parses this and returns 2 Arrays.

Now I'm trying to turn this XML into 2 arrays but using VBScript in another .htm page. Thus:-

8<----------------
'Set up chart data from XMLIsland
    'Extract the contents of the XML Data island and insert it into two
    'arrays: one array for the chart categories and one array for the
    'chart values.
    Dim nCount, nodes, j
    Dim xmldoc
    Set xmlDoc = CreateObject("MSXML2.DOMDocument")
    xmlDoc.async=false
    xmlDoc.loadXML sXMLDSCPath
    Set nodes = xmlDoc.childNodes.Item(0).childNodes.Item(1).child Nodes
    nCount = nodes.length
    Redim aReportDate(nCount)
    Redim aValues(nCount)
    For j=1 to nCount
       aReportDate(j) = Nodes.Item(j - 1).Attributes.Item(0).Text
       aValues(j) = Nodes.Item(j - 1).Attributes.Item(1).Text
    Next

8<--------------------

Now sXMLDSCPath is returning a corrent link, which contains a corrent, well formatted XML page.
But I get an 'Object required' error for the following line:-

Set nodes = xmlDoc.childNodes.Item(0).childNodes.Item(1).child Nodes


I know this is going to be horribly simple, but I just don't know why it doesn't work in VBScript. I haven't posted the XML (I didn't want to post too much info) but can if required.

any help greatly appreciated.

Neil

P.S. - I know this would fly in .NET, but for various reasons has to be done in old fashioned VBScript in an HTM page.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter multi-tier XML data island jayme27 XSLT 1 April 22nd, 2006 04:53 AM
XML Data Island Display Problem marcuslim XML 8 December 7th, 2004 04:00 AM
How to create a string from XML Island in HTML? chandima Javascript How-To 2 October 10th, 2003 02:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.