Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML DOM? Deleting a node...

Status
Not open for further replies.

JoeMcGarvey

Programmer
Oct 31, 2002
47
US
Hi -
I have an XML doc structured as such:


I am accessing the DOM with ASP. I am passing a delete request for a particular node to the delete function through a URL variable. The URL variable is "file" with the value as the image name, ie:

delete.asp?file=image1.jpg

My delete function should find the "entity type='asset'" node and delete it.

Set objRoot = objXML.documentElement.firstChild.childNodes.item(3)
Set objNode = objRoot.SelectSingleNode("entity[File='" & file & "']")
objRoot.removeChild(objNode)

The above code works, but only when I request a delete from the first "entity type='folder'". I receive an error when I try to delete "image3.jpg" or "image4.jpg" because the function is looking for those images in the first folder, and does not find them.

I think my problem is in this line:

Set objRoot = objXML.documentElement.firstChild.childNodes.item(3)

How can I genericize this to look at all "entity type='folder'" nodes?

Thanks in advance!!

Joe


Joe McGarvey - Web Application Developer
Paragraph, Inc. - Paragraph Publisher -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top