public function getChildOptionalElements($parent_type)
{
$open_et = array();
if (is_array($this->open_elements)) {
foreach ($this->open_elements as $open) {
$et = $open->getElementType();
if ($et && $et->isChild() && $et->parent_element_type->class_name == $parent_type->class_name) {
$open_et[] = $et->class_name;
}
}
}
$optional = array();
foreach ($parent_type->child_element_types as $child_type) {
if (!in_array($child_type->class_name, $open_et)) {
$optional[] = $child_type->getInstance();
}
}
return $optional;
}