Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: writing/appending xml to file


Message #1 by "Josh Millstein" <shizny@y...> on Fri, 27 Sep 2002 16:20:45
I have the following asp script that I want to use when it receives an xml
object through the request.form variable.  This is not working.  No file is
changing etc.  I have set up all the files so that is not the problem.  Is
this the way I should be appending xml using asp.  Do I need an xml object
for asp installed on the server?  If I do I don't know how to check for
that and would like info on how I can check that.  Thanks.

<%@ Language=VBScript %>
<%
if Request.Form  <> "" Then
	dim XMLin, AIMLfile
	set XMLin = Server.CreateObject("Msxml2.DOMDocument.4.0")
	set AIMLfile = Server.CreateObject("Msxml2.DOMDocument.4.0")

	'Load the incomming XML POST
	XMLin.loadXML(Request.Form)
	
	'load our current Aiml file
	AIMLfile.load(Server.MapPath(".") & "/aiml.xml")
	
	'Append the incomming to the existing AIML file
	AIMLfile.documentElement.appendChild(XMLin.documentElement)
	
	'Resave the File
	AIMLfile.save(Server.MapPath("aiml.xml"))
End If%>

  Return to Index