Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. 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 Professional 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 December 2nd, 2005, 08:23 AM
Authorized User
 
Join Date: Nov 2005
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Asp and XMP error

Hello all,

I hope that this is in the right place - sorry if it is not.

I have an asp script (which is contained in a .vbs file) that takes info from an XML page and inserts it into a database. I was trying to get the the script to preform a test to see if the xml script contains a certain element - if it does, then enter it into a database.

Here is the code :

Code:
Dim XMLDom
Dim ItemID
Dim DbConn
Dim SQLString
Dim ANArticleNode
Dim CollectionOfArticleNodes
Dim CollectionOfArticleNodes2
Dim cst

Set XMLDom = CreateObject("MSXML2.DomDocument.4.0")
XMLDom.async = False
XMLDom.setProperty "ServerHTTPRequest", True

Set DbConn = Createobject("adodb.connection")
DbConn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=test1.mdb"

'-- Load the XML data from your live URL
XMLDom.Load("http://feeds.directnews.org.uk/?ad96035d-f9fe-4a3f-a5b2-ad546b2ed850") 

'-- Create a reference to a collection of all Article Tags within the downloaded XML Document
Set CollectionOfArticleNodes = XMLDom.SelectNodes("InfoStreamResults/Article/Categories/Category")

'-- Iterate the collection of Article Tags 
For Each ANArticleNode in CollectionOfArticleNodes 
    ItemID = ANArticleNode.SelectSingleNode("@ID").text


if ItemID = "430009735" then

set CollectionOfArticleNodes2 = XMLDom.SelectNodes("InfoStreamResults/Article")


Heading = ANArticleNode.SelectSingleNode("Heading").text    


'-- Insert the item into the local database
SQLString = "INSERT INTO test (Heading) " _
          & "VALUES('" & EncodeIt(Heading) & "');" 
    DbConn.Execute(SQLString)    

End If 

Next

'-- Handles quotations in text
Function EncodeIt(TextString)
    TextString = Replace(CStr(TextString), "''", "'")
    TextString = Replace(TextString, "'", "''")
    EncodeIt = TextString
End Function

And here is the error message I am getting :

Code:
Object required: 'SelectSingleNode(...)
any ideas as to what might be the problem here? I really appreciate any input as I have a horrible deadline for this! :o


Thanks folks








Similar Threads
Thread Thread Starter Forum Replies Last Post
Error in Migrating Project from ASP to ASP.NET hbansal ASP.NET 1.0 and 1.1 Professional 0 September 12th, 2008 05:48 AM
error.asp? grstad Classic ASP Basics 3 December 8th, 2006 03:58 PM
extract XMP metadata from a JPEG file mega Classic ASP Professional 6 September 8th, 2006 05:03 AM
extract xmp metadata from jpeg image header prs_kishore C++ Programming 0 October 18th, 2004 08:08 AM
ASP error cudjoe83 Classic ASP Databases 2 August 26th, 2003 04:49 AM





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