Are your rows and cells represented by element nodes only?
If so, why do you still ask for isElement()?
If not, why do you only remove the element nodes?
What about attributes and text?