void c_SimpleXMLElement::t_offsetset(CVarRef index, CVarRef newvalue) {
  if (index.isInteger()) {
    raise_error("unable to replace a SimpleXMLElement node");
    return;
  }
  String name = index.toString();
  if (name.empty()) {
    raise_error("cannot create unnamed attribute");
    return;
  }

  String sv = newvalue.toString();
  if (m_attributes.toArray().exists(name)) {
    t_offsetunset(index);
  }

  if (m_node == nullptr) {
    raise_error("cannot create attribute on this node");
    return;
  }
  xmlNodePtr newnode = (xmlNodePtr)xmlNewProp(m_node, (xmlChar *)name.data(),
                                              (xmlChar*)sv.data());
  if (newnode) {
    m_attributes.set(name, sv);
  }
}
void c_SimpleXMLElement::t_offsetset(CVarRef index, CVarRef newvalue) {
  if (index.isInteger()) {
    raise_error("unable to replace a SimpleXMLElement node");
    return;
  }
  String name = index.toString();
  if (name.empty()) {
    raise_error("cannot create unnamed attribute");
    return;
  }

  String sv = newvalue.toString();
  if (m_attributes.toArray().exists(name)) {
    t_offsetunset(index);
  }

  if (m_node == nullptr) {
    raise_error("cannot create attribute on this node");
    return;
  }
  xmlNodePtr newnode = (xmlNodePtr)xmlNewProp(m_node, (xmlChar *)name.data(),
                                              (xmlChar*)sv.data());
  if (newnode) {
    m_attributes.set(name, sv);
  }
}