Delete item from xml???
-
Please tell me wat's wrong with the code below I'd try both way in the asp file to delete the childnode in xml but it couldn't work *** News.xml *** -------------------------------------------------
Test 1 Testing 123 1/9/2003
Test 2 Testing 321 1/9/2003
------------------------------------------------- *** file.asp *** ------------------------------------------------- <% If Request.QueryString("Action")="Delete" Then Dim strID Dim objXML Dim subArticle Dim objLst Dim subLst strID = CInt(Request.Form("selectAnnouncement")) Set objXML = Server.CreateObject("Microsoft.XMLDOM") objXML.Load(Server.MapPath("News.xml")) **** 01 **** Set objLst = objXML.getElementsByTagName("Article") Set subLst = objLst.item(strID) objXML.documentElement.removeChild subLst **** 02 **** 'Set subArticle = objXML.documentElement.childNodes(strID) 'objXML.documentElement.removeChild (subArticle) Set childNode = Nothing End If %> -------------------------------------------------
-
Please tell me wat's wrong with the code below I'd try both way in the asp file to delete the childnode in xml but it couldn't work *** News.xml *** -------------------------------------------------
Test 1 Testing 123 1/9/2003
Test 2 Testing 321 1/9/2003
------------------------------------------------- *** file.asp *** ------------------------------------------------- <% If Request.QueryString("Action")="Delete" Then Dim strID Dim objXML Dim subArticle Dim objLst Dim subLst strID = CInt(Request.Form("selectAnnouncement")) Set objXML = Server.CreateObject("Microsoft.XMLDOM") objXML.Load(Server.MapPath("News.xml")) **** 01 **** Set objLst = objXML.getElementsByTagName("Article") Set subLst = objLst.item(strID) objXML.documentElement.removeChild subLst **** 02 **** 'Set subArticle = objXML.documentElement.childNodes(strID) 'objXML.documentElement.removeChild (subArticle) Set childNode = Nothing End If %> -------------------------------------------------
try saving the file...
"When the only tool you have is a hammer, a sore thumb you will have."
-
try saving the file...
"When the only tool you have is a hammer, a sore thumb you will have."
... and replace "Microsoft.XMLDOM" with "MSXML2.DOMDocument" optionally followed by a version number, like "MSXML2.DOMDocument.4.0"