I'm trying to use classic ASP to delete the first child's child.
Here's the the XML example (XSPF PL):
Here's the ASP code I'm using:
Anyone who understand the DOM tree will probably already know this is deleting all tracks from my playlist, instead of the first one.
Would someone be so kind as to help me out or better yet give me a more efficient way to accomplish this?
Here's the article I've been using:
Thanks In Advance
Here's the the XML example (XSPF PL):
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<playlist version="1" xmlns="[URL unfurl="true"]http://xspf.org/ns/0/">[/URL]
<title>Playlist</title>
<info>Whatever</info>
<trackList>
<track>
<annotation>Me - You</annotation>
<location>../Me/You.Mp3</location>
<image>../Me/You.jpg</image>
</track>
<track>
<annotation>You - Me</annotation>
<location>../You/Me.Mp3</location>
<image>../You/Me.jpg</image>
</track>
</trackList>
</playlist>
Here's the ASP code I'm using:
Code:
Dim objXML
Dim objXMLTracks
Dim objXMLTrack
Dim objRoot
Dim objNode
Set objXML = Server.CreateObject("MSXML2.DomDocument.3.0")
objXML.async = False
objXML.load (Server.MapPath("playlists/Playlist.xml"))
'Collect All Tracks From Playlist
Set objXMLTracks = objXML.getElementsByTagName("track")
'Select First Track
Set objXMLTrack = objXMLTracks.Item(0)
Set objRoot = objXML.documentElement
Set objNode = objRoot.SelectSingleNode("trackList[track/annotation='" & objXMLTrack.firstChild.text & "']")
objRoot.removeChild(objNode)
Set objNode = Nothing
Set objRoot = Nothing
Set objXMLTrack = Nothing
Set objXMLTracks = Nothing
'Save The Edited Playlist
objXML.save (Server.MapPath("playlists/Playlist.xml"))
Set objXML = Nothing
Anyone who understand the DOM tree will probably already know this is deleting all tracks from my playlist, instead of the first one.
Would someone be so kind as to help me out or better yet give me a more efficient way to accomplish this?
Here's the article I've been using:
Thanks In Advance