XML removeChild error in ASP.
Posted on 2003-03-22
I am going through the Sams ASP in 24 hours and am trying to do the web store (chap 24). Originally I had a problem when going through my XML using the "BagItems.childNodes" part. I sorted that by changing it to "BagItems.getElementsByTagName("product")". This does everything I want. Except, of course, one thing. I am now trying to delete a node when a specific value is 0.
The code "BagItems.removeChild(item)" returns the error "The parameter Node is not a child of this Node." If I change the code above back to "BagItems.childNodes" I get the error "item.attributes.getNamedItem(...)" before it even gets to the removeChild part (which is why I changed it to "BagItems.getElementsByTagName("product") in the first place).
Can anyone tell me why this isn't working? And what my alternatives might be. I can't see why "product" isn't a child node. And even if that is irrelevant that why "item" isn't a node that can be removed.
I'll cross post this in XML area as well.