[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2006-10-20
2
Medium Priority
?
1,186 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
  • 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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
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…
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…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

834 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