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 April 6th, 2004, 11:35 AM
Registered User
 
Join Date: Mar 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rj_mayer
Default Problem with For loop, iterating through XML Doc

I have the following loop:

The XML document has been set up as you would expect.

For intCount = 0 to objElement.childNodes.length - 1

strXMLUser = objElement.childNodes.Item(intCount).childNodes.it em(1).text
strXMLPassword = objElement.childNodes.Item(intCount).childNodes.it em(6).text

    If (strEnteredUser = strXMLUser) AND (strEnteredPassword = strXMLPassword) then

    strSalutation = objElement.childNodes.Item(intCount).childNodes.it em(2).text
    strSurname = objElement.childNodes.Item(intCount).childNodes.it em(3).text

    else
        Session ("Error") = Session ("Error") & "Username and Password match not found"
           End If
Next

As you can see, it iterates through each record and if the User and Password match a record, it logs them in by greeting the user. Now, this works fine as long as the record exists. If it doesn't, it throws the following error:

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'objElement.childNodes.Item(...).childNodes.Item(. ..)'

It seems to be a problem that the loop gets to the end of the file and fails to find a record.

Can anyone help?

Richard

 
Old April 6th, 2004, 01:13 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

What does your XML look like?
 
Old April 6th, 2004, 01:16 PM
Registered User
 
Join Date: Mar 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to rj_mayer
Default

Sorry, it was indeed the XML. A dud record. Thanks for your interest.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating XML doc ; writing string(xml format) into KamalRaturi XML 5 May 28th, 2008 05:51 AM
Help making a doc using XML topshed XML 2 January 28th, 2006 08:05 PM
PROBLEM TO OPEN XML DOC IN 98SE chanti XML 0 August 9th, 2004 06:42 AM
whole database to XML doc beyondforsaken VB How-To 4 June 11th, 2003 08:12 PM





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