Variant c_SimpleXMLElement::t___unset(Variant name) {
  if (m_node == nullptr) return uninit_null();

  Variant node;
  if (m_is_attribute) {
    node = m_attributes[name];
  } else {
    node = m_children[name];
  }

  if (node.isObject()) {
    c_SimpleXMLElement *elem =
      node.toObject().getTyped<c_SimpleXMLElement>();
    if (elem->m_node) {
      xmlUnlinkNode(elem->m_node);
    }
  } else if (node.isArray()) {
    for (ArrayIter iter(node.toArray()); iter; ++iter) {
      c_SimpleXMLElement *elem = iter.second().toObject().
        getTyped<c_SimpleXMLElement>();
      if (elem->m_node) {
        xmlUnlinkNode(elem->m_node);
      }
    }
  }

  if (m_is_attribute) {
    m_attributes.remove(name);
  } else {
    m_children.remove(name);
  }
  return uninit_null();
}
Variant c_SimpleXMLElement::t___unset(Variant name) {
  if (m_node == nullptr) return uninit_null();

  Variant node;
  if (m_is_attribute) {
    node = m_attributes[name];
  } else {
    node = m_children[name];
  }

  if (node.isObject()) {
    c_SimpleXMLElement *elem =
      node.toObject().getTyped<c_SimpleXMLElement>();
    if (elem->m_node) {
      xmlUnlinkNode(elem->m_node);
    }
  } else if (node.isArray()) {
    for (ArrayIter iter(node.toArray()); iter; ++iter) {
      c_SimpleXMLElement *elem = iter.second().toObject().
        getTyped<c_SimpleXMLElement>();
      if (elem->m_node) {
        xmlUnlinkNode(elem->m_node);
      }
    }
  }

  if (m_is_attribute) {
    m_attributes.remove(name);
  } else {
    m_children.remove(name);
  }
  return uninit_null();
}