将HTML表单数据存储为XML格式__教程 |
|
日期:2007-5-20 1:13:28 人气:139 [大 中 小] |
|
|
|
objRoot.AppendChild objField ’Append the field_value element as a child of the field elemnt. objField.AppendChild objFieldValue End If Next ’Create the xml processing instruction. Set objPI = objDom.CreateProcessingInstruction("xml", "version=""1.0""") ’Append the processing instruction to the XML document. objDom.InsertBefore objPI, objDom.ChildNodes(0) ’Save the XML document. objDom.Save strXMLFilePath & "" & strFileName ’Release all of your object references. Set objDom = Nothing Set objRoot = Nothing Set objField = Nothing Set objFieldValue = Nothing Set objAttID = Nothing Set objAttTabOrder = Nothing Set objPI = Nothing End Function ’Do not break on an error. On Error Resume Next ’Call the ConvertFormtoXML function, passing in the physical path to ’save the file to and the name that you wish to use for the file. ConvertFormtoXML "F:\Asp\","Contact.xml" ’Test to see if an error occurred, if so, let the user know. ’Otherwise, tell the user that the operation was successful. If Err.Number <> 0 then Response.Write("Errors occurred while saving your form submission.") Else Response.Write("Your form submission has been saved. Go Back") End If %>
如果你是在你自己的应用程序中使用以上代码,请谨记一件事情,在"ConvertFormtoXML"函数已经运行的情况下,如果XML文件名已经存在,那么,文件将会被覆盖。在此,我建议在使用"ConvertFormtoXML"功能前,最好用随机建立的文件名。这样,就将有价值数据被改写的风险降为零。 |
|
出处:本站原创 作者:佚名 |
|
|