void c_SimpleXMLElement::t___construct(const String& data, int64_t options /* = 0 */,
                                       bool data_is_url /* = false */,
                                       const String& ns /* = "" */,
                                       bool is_prefix /* = false */) {
  String xml = data;
  if (data_is_url) {
    Variant ret = f_file_get_contents(data);
    if (same(ret, false)) {
      raise_warning("Unable to retrieve XML content from %s", data.data());
      return;
    }
    xml = ret.toString();
  }

  xmlDocPtr doc = xmlReadMemory(xml.data(), xml.size(),
                                nullptr, nullptr, options);
  if (doc) {
    m_root = this;
    m_doc =
      Resource(NEWOBJ(XmlDocWrapper)(doc, o_getClassName()));
    m_node = xmlDocGetRootElement(doc);
    if (m_node) {
      m_children = create_children(m_root, m_doc, m_node, ns, is_prefix);
      m_attributes = collect_attributes(m_node, ns, is_prefix);
    }
  } else {
    throw Object(SystemLib::AllocExceptionObject(
        "String could not be parsed as XML"));
  }
}
void c_SimpleXMLElement::t___construct(const String& data, int64_t options  ,
                                       bool data_is_url  ,
                                       const String& ns  ,
                                       bool is_prefix  ) {
  String xml = data;
  if (data_is_url) {
    Variant ret = f_file_get_contents(data);
    if (same(ret, false)) {
      raise_warning("Unable to retrieve XML content from %s", data.data());
      return;
    }
    xml = ret.toString();
  }

  xmlDocPtr doc = xmlReadMemory(xml.data(), xml.size(),
                                nullptr, nullptr, options);
  if (doc) {
    m_root = this;
    m_doc =
      Resource(NEWOBJ(XmlDocWrapper)(doc, o_getClassName()));
    m_node = xmlDocGetRootElement(doc);
    if (m_node) {
      m_children = create_children(m_root, m_doc, m_node, ns, is_prefix);
      m_attributes = collect_attributes(m_node, ns, is_prefix);
    }
  } else {
    throw Object(SystemLib::AllocExceptionObject(
        "String could not be parsed as XML"));
  }
}