public function canRemoveNode($nodeName, $throw = false)
{
$childDefs = $this->getChildNodeDefinitions();
foreach ($childDefs as $child) {
if ($nodeName === $child->getName() && ($child->isMandatory() || $child->isProtected())) {
if ($throw) {
if ($child->isMandatory()) {
$errorMsg = "Can't remove the mandatory childnode: " . $child->getName();
} else {
$errorMsg = "Can't remove the protected childnode: " . $child->getName();
}
throw new ConstraintViolationException($errorMsg);
}
return false;
}
}
return true;
}