problem med saving af xml fil via asp side
Jeg kan ikke finde feljen der gør at asp siden ikke gemmer den genereret xml fil:Html Siden:
<html>
<head>
<title>
</title>
</head>
<body>
<form action="Form.asp" method="post">
<h3>person info</h3>
First Name: <input type="text" id="firstName" name="firstName"><br>
Last Name: <input type="text" id="lastName" name="lastName"><br>
Address #1: <input type="text" id="address1" name="address1"><br>
Address #2: <input type="text" id="address2" name="address2"><br>
Phone Number: <input type="text" id="phone" name="phone"><br>
E-Mail: <input type="text" id="email" name="email"><br>
<input type="submit" id="btnSub" name="btnSub" value="Submit"><br>
</form>
</body>
</html>
Asp siden:
<html>
<head>
<title></title>
</head>
<body>
<%
Function ConvertFormtoXML(strXMLFilePath, strFileName)
Dim objDom
Dim objRoot
Dim objField
Dim objFieldValue
Dim objattID
Dim objattTabOrder
Dim objPI
Dim x
Set objDom = server.CreateObject("Microsoft.XMLDOM")
objDom.preserveWhiteSpace = True
Set objRoot = objDom.createElement("contact")
objDom.appendChild objRoot
For x = 1 To Request.Form.Count
If instr(1,Request.Form.Key(x),"btn") = 0 Then
Set objField = objDom.createElement("field")
Set objattID = objDom.createAttribute("id")
objattID.Text = Request.Form.Key(x)
objField.setAttributeNode objattID
Set objattTabOrder = objDom.createAttribute("taborder")
objattTabOrder.Text = x
objField.setAttributeNode objattTabOrder
Set objFieldValue = objDom.createElement("field_value")
objFieldValue.Text = Request.Form(x)
objRoot.appendChild objField
objField.appendChild objFieldValue
End If
Next
Set objPI = objDom.createProcessingInstruction("xml", "version='1.0'")
objDom.insertBefore objPI, objDom.childNodes(0)
objDom.save strXMLFilePath & "\" & strFileName
Set objDom = Nothing
Set objRoot = Nothing
Set objField = Nothing
Set objFieldValue = Nothing
Set objattID = Nothing
Set objattTabOrder = Nothing
Set objPI = Nothing
End Function
On Error Resume Next
ConvertFormtoXML "http://www.wedia.dk","Contact.xml"
If err.number <> 0 then
Response.write("xml filen blev ikke gemt.")
Else
Response.write("xml filen er blevet gemt.")
End If
%>
</body>
</html>