Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Delete item from xml???

Delete item from xml???

Scheduled Pinned Locked Moved XML / XSL
sysadmintestingbeta-testingxmlquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Daron Tan
    wrote on last edited by
    #1

    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 %> -------------------------------------------------

    P 1 Reply Last reply
    0
    • D Daron Tan

      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 %> -------------------------------------------------

      P Offline
      P Offline
      Philip Fitzsimons
      wrote on last edited by
      #2

      try saving the file...


      "When the only tool you have is a hammer, a sore thumb you will have."

      D 1 Reply Last reply
      0
      • P Philip Fitzsimons

        try saving the file...


        "When the only tool you have is a hammer, a sore thumb you will have."

        D Offline
        D Offline
        Diederik de Haas
        wrote on last edited by
        #3

        ... and replace "Microsoft.XMLDOM" with "MSXML2.DOMDocument" optionally followed by a version number, like "MSXML2.DOMDocument.4.0"

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups