void c_SimpleXMLElement::t_offsetunset(CVarRef index) {
  if (index.isInteger()) {
    raise_error("unable to remove a SimpleXMLElement node");
    return;
  }

  String name = index.toString();
  if (name.empty()) {
    raise_error("cannot remove unnamed attribute");
    return;
  }

  if (m_attributes.toArray().exists(name) && m_node) {
    for (xmlAttrPtr attr = m_node->properties; attr; attr = attr->next) {
      if (String((char*)attr->name, xmlStrlen(attr->name), CopyString) ==
          name) {
        xmlUnlinkNode((xmlNodePtr)attr);
        break;
      }
    }
  }

  m_attributes.remove(name);
}
void c_SimpleXMLElement::t_offsetunset(CVarRef index) {
  if (index.isInteger()) {
    raise_error("unable to remove a SimpleXMLElement node");
    return;
  }

  String name = index.toString();
  if (name.empty()) {
    raise_error("cannot remove unnamed attribute");
    return;
  }

  if (m_attributes.toArray().exists(name) && m_node) {
    for (xmlAttrPtr attr = m_node->properties; attr; attr = attr->next) {
      if (String((char*)attr->name, xmlStrlen(attr->name), CopyString) ==
          name) {
        xmlUnlinkNode((xmlNodePtr)attr);
        break;
      }
    }
  }

  m_attributes.remove(name);
}