Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the 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 June 19th, 2003, 05:23 AM
Registered User
 
Join Date: Jun 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Getting Simple XML Reading In ASP Happening

Just trying to Read an XML file from the server into an ASP page, can't find any help in VS or anywhere else

This Code Falls Over On The Line Marked With An Asterisk...

 strXMLFile = Request.Form.Item("strFileName")
 Set XMLdoc = Server.CreateObject("Microsoft.XMLDOM")
 XMLdoc.async = False
 XMLdoc.Load("..\PagesXML\" & strXMLFile)

 Set LoopElem = XMLdoc.documentElement
*Set PagesElem = LoopElem.Item(0).childNodes
 For pCount = 0 To (PagesElem.length - 1) Step 1
     Set PageElem = PagesElem.Item(pCount)
     strPageName = PageElem.childNodes.Item(0).Text
     Set FieldsElem = StatementElem.childNodes.Item(1).childNodes
     intFields = FieldsElem.length
     If intFields > 0 Then
         For fCount = 0 To (FieldsElem.length - 1) Step 1
             Set FieldElem = FieldsElem.Item(iCount)
             strFieldName = FieldElem.childNodes.Item(0).Text
         Next
     End If
 Next

The Error Message On IE Is...

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required
/subfolder/ReadInXML2.asp, line 13

Where Am I Going Wrong ?

Any Help Would Be Much Appreciated (It's Probably Apparent But I've Never Used ASP To Read In XML Before)

Many Thanks - Trev
 
Old June 19th, 2003, 09:22 AM
Registered User
 
Join Date: Jun 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

munkimagik

First off, you need to use server.mappath to locate the file to load.
That is why there is no object set for LoopElem.

XMLdoc.Load("..\PagesXML\" & strXMLFile)
    Should read
XMLdoc.Load(Server.Mappath("..\PagesXML\" & strXMLFile))

Next Set PagesElem = LoopElem.Item(0).childNodes
    Should read
Set PagesElem = LoopElem.childNodes

That's all for now. Try that and see how it goes





Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading XML through ASP jeffm_22 Classic ASP XML 3 June 11th, 2010 07:02 AM
Reading XML file using ASP itHighway Classic ASP XML 1 June 7th, 2006 06:16 AM
Reading XML file using ASP itHighway Classic ASP Basics 1 May 1st, 2006 06:21 PM
Reading XML string using asp itHighway Classic ASP XML 2 March 10th, 2005 11:54 PM
Reading XML from ASP texasraven Classic ASP XML 2 February 26th, 2004 03:26 PM





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