[VIVO-1608] Fix node removal from the XML so that it works with an XML tree of arbitrary depth (#89)
Resolves: https://jira.duraspace.org/browse/VIVO-1608
This commit is contained in:
parent
5ca7a9235f
commit
dc74a5264f
1 changed files with 6 additions and 1 deletions
|
@ -197,7 +197,12 @@ public class CustomListViewConfigFile {
|
|||
*/
|
||||
NodeList doomed = element.getElementsByTagName(tagName);
|
||||
for (int i = doomed.getLength() - 1; i >= 0; i--) {
|
||||
element.removeChild(doomed.item(i));
|
||||
/*
|
||||
* As the node to be removed may be at an arbitrary depth in the DOM tree,
|
||||
* we need to get the parent of the node that we are trying to remove,
|
||||
* and then remove the child from there.
|
||||
*/
|
||||
doomed.item(i).getParentNode().removeChild(doomed.item(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue