Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Variable is undefined: 'oXML' - classic ASP (Building an XML FIle)

Posted on 2006-10-20
2
Medium Priority
?
1,180 Views
Last Modified: 2008-02-01
I need some help with error message about an xml  variable not being undefined.  I am trying to create an xml file from a classic ASP program but the I am getting an error on lione 286 as documented below.  Any suggestions?  

line 286 -  Set oXML = Server.CreateObject("Microsoft.XMLDOM")

Error Type:
Microsoft VBScript runtime (0x800A01F4)   Variable is undefined: 'oXML'
/Apogee/residential/account_history2.asp, line 286

My Code:

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
Response.Write("Test 2")
      ' find xml file path  
 dim strFilename,strXMLFile  
 strFilename = "Apogee.xml"  
 strXMLFile=server.mapPath(strFilename)  
 Set oXML = Server.CreateObject("Microsoft.XMLDOM")
 Set oXML.DocumentElement = oXML.createElement("P21_VPT_DATA")
 
 ' check file exists  
 bitFileExists = oXML.load(strXMLFile)  
 
 if bitFileExists then  
 tmpChildnodes = oXML.documentElement.childnodes.length - 1  
 intCurrentRecord = tmpChildnodes + 1  
 else  
 ' create xml  
 oXML.appendChild(oXML.createProcessingInstruction("xml","version=""1.0"""))  
 oXML.appendChild(oXML.createElement("BillingData"))  
 intCurrentRecord = 0  
 end if  
 
 ' create record  
 Set oXMLRec = oXML.createElement("UtilityId")  
 
 ' Create an id attribute  
 Set oAtt = oXML.createAttribute("id")  
 oAtt.Text = intCurrentRecord  
 oXMLRec.SetAttributeNode oAtt  
 
 ' Set remaining fields  
           
 for HRi = 0 to UBound(results, 2)
 ' name  
 Set oXMLData = oXML.CreateElement("BillingCycleData")
 oXMLRec.appendChild(oXML.createElement("meterReadDate"))
 oXMLRec.appendChild(oXML.createElement("revenue"))  
 oXMLRec.appendChild(oXML.createElement("usuage"))  
 oXMLRec.childnodes(0).text = results(BILL_DATE, HRi)
 oXMLRec.childnodes(1).text = results(BILL_AMOUNT, HRi)  
 oXMLRec.childnodes(2).text = results(KILOWATT_USAGE, HRi)
 oXML.DocumentElement.AppendChild oXMLData.cloneNode(true)
 next
 

 oXML.documentElement.appendChild(oXMLRec.cloneNode(True))  

 oXML.save strXMLFile  

 response.redirect(strFilename)  
 oXML = Nothing  
 end if

0
Comment
Question by:Hojoformo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 2000 total points
ID: 17775378
Hojoformo,

Are you using Option Explicit so that you are required to define variables?  Add the line below just above the line with the error.

Dim oXML

If that doesn't fix it let me know.  Let me know if you have any questions or need more information.

b0lsc0tt
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 17775915
I'm glad that I could help.  Thank you for the grade, the points and the fun question.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question