Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP XML
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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.
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:13 AM.


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