XML document content
XML Version = "1.0" Encoding = "GB2312"?>
Read the ASP code of the document
<% 'Specified XML document path strSourceFile = Server.MapPath ( "test.xml")' to create a free-threaded XML object Set objXML = Server.CreateObject ( "Microsoft.FreeThreadedXMLDOM") 'document is loaded into memory objXML.load (strSourceFile ) 'Choose the Note Node set objRootsite = objxml.documentElement.selectsinglenode ("Note")' assigns each node value to the corresponding variable ID = Objroots.childNodes.Item (0) .childnodes.Item (0) .text from = Objrootsite .childNodes.Item (1) .Text TOER = Objroots.childNodes.Item (0) .childNodes.Item (2) .text content = objrootsite.childNodes.Item (0) .childNodes.Item (0) .childNodes.Item 3) .Text 'Output Variable Value Response.write ID Response.write from response.write TOER Response.write Content Set Objxml = NOTHING%>
Modify the ASP code of the XML document
<% 'Create an XML document
<% 'Modify the value of the specified node of the XML document FilePath = "Test.xml" set objxml = server.createObject ("msxml2.domdocument") objxml.async = false loadResult = objxml.load (server.mappath (filepath)) IF NOT LoadResult Ten Response.write ("Load XML file error!") Response.end end if i = request.queryString ("id") set objNodes = objxml.selectsinglenode ("XML / Note / Item [ID = '" & i & "']") IF not isnull (objNodes) Then from = "lxer" if from <> "" "" "" "" "" "" "" "" "" "" "·" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" End if set objxml = Nothing end if%> <% 'Delete Specify Node Delid = Request.QueryString ("Delid") SourceFile = Server.MAppath ("Test.xml") if Delid <> "" "" "" ". CreateObject ( "Msxml2.DOMDocument") source.async = false source.load (sourceFile) Set currNode = source.selectSingleNode ( "xml / note / item [id = '" & delid & "']") if Not IsNull (currNode ) The burrnode.parentnode.removechild (currnode) EN D if Source.save (Sourcefile) response.write ("