Hi,
I've been asked to create an xml file that will mirror the information currently pulled by an .asp page I have created. As an example, this .asp page uses a stored procedure to pull customer information and displays it on a page. What I want to do is for the page to pull the same information, but also write it to an .xml file. Here is what I have so far can anyone tell me if I am on the right track as I can't seem to get it to work. Please note that this code is used in the very same .asp file.
I've been asked to create an xml file that will mirror the information currently pulled by an .asp page I have created. As an example, this .asp page uses a stored procedure to pull customer information and displays it on a page. What I want to do is for the page to pull the same information, but also write it to an .xml file. Here is what I have so far can anyone tell me if I am on the right track as I can't seem to get it to work. Please note that this code is used in the very same .asp file.
Code:
<%
dim xmlDoc
dim xmlPI
dim nodeRoot
dim bankNode
dim rtNode
dim phoneNode
dim alt_phoneNode
dim aru_phoneNode
'Instantiate the Microsoft XMLDOM.
Set xmlDoc = Server.CreateObject("MICROSOFT.XMLDOM")
xmlDoc.preserveWhiteSpace = True
'Create root
Set nodeRoot = xmlDoc.createElement("check_info")
xmlDoc.appendChild nodeRoot
'Create the required nodes
Set bankNode = xmlDoc.createElement("bank")
Set rtNode = xmlDoc.createElement("rt")
Set phoneNode = xmlDoc.createElement("phone")
Set alt_phoneNode = xmlDoc.createElement("alt_phone")
Set aru_phoneNode = xmlDoc.createElement("aru_phone")
'Assign the variables
bankNode.text = bankname
rtNode.text = rt
phoneNode.text= phone
alt_phoneNode.text = alt_phone
aru_phoneNode.text = aru_phone
nodeRoot.appendChild(bankNode)
nodeRoot.appendChild(rtNode)
nodeRoot.appendChild(phoneNode)
nodeRoot.appendChild(alt_phoneNode)
nodeRoot.appendChild(aru_phoneNode)
'Create the xml processing instruction.
Set xmlPI = xmlDoc.createProcessingInstruction("xml", "version='1.0'")
'Append the processing instruction to the XML document.
xmlDoc.insertBefore xmlPI, xmlDoc.childNodes(0)
'Save the XML document.
xmlDoc.save("Person.xml")
'Release all of your object references.
Set xmlDoc = Nothing
Set xmlPI = Nothing
Set nodeRoot = Nothing
Set bankNode = Nothing
Set rtNode = Nothing
Set phoneNode = Nothing
Set alt_phoneNode = Nothing
Set aru_phoneNode = Nothing
%>