Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP XML
|
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 January 25th, 2005, 10:16 PM
Authorized User
 
Join Date: Apr 2004
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reading a null value using MSXML2.ServerXMLHTTP

Hi! I'm trying to read from an xml file and then copy the values to an array. However, I only want to copy the nodes with values. Those with null should not be copied anymore. I came up with this code. But this still includes the null values. The IF statement seems to be not working. Can someone please help me? Thanks!

Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
url = "http://httpsomething/" & filename
xml.Open "GET", url, False
xml.Send

Set NodeList = xml.responseXml.selectNodes(nodename)
For Each objChild In NodeList
    if objChild.hasChildNodes() then
        dim i, flag, total
        total=0
        i=0
        flag=0
        do while (total<objChild.childNodes.length and flag=0)
            if objChild.childNodes(i).text="" then
                flag=1
            end if
            total=total+1
        loop
        flag=0
        response.write "total: "&total
        redim arr(total)
        do while (i<total)
            arr(i)=objChild.childNodes(i).text
            i=i+1
        loop
      end if
next
 
Old August 1st, 2006, 05:45 PM
Registered User
 
Join Date: Jun 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to g000we Send a message via Yahoo to g000we
Default

What's the output of objChild.childNodes.length?

What's the value of total?

In fact, what is the output you get?

Try using a test XML document and give me the results from that, also the test xml document.

Jesus == Way == Truth == Life == Love == God





Similar Threads
Thread Thread Starter Forum Replies Last Post
MSXML2.ServerXMLHTTP & https prakharbirla Classic ASP XML 0 October 17th, 2006 10:13 AM
MSXML2.ServerXMLHTTP & https prakharbirla Classic ASP Components 0 October 17th, 2006 10:11 AM
MSXML2.ServerXMLHTTP help appreciated!! Steven1984 Classic ASP Professional 0 June 4th, 2005 12:49 PM
Null Exception while reading ajindal Classic ASP XML 3 December 14th, 2004 06:20 AM
Reading Files In - end of file and placing null djwicks C# 0 May 15th, 2004 11:23 PM





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