static Object create_element(c_SimpleXMLElement *root,
                             CResRef doc, xmlNodePtr node,
                             const String& ns, bool is_prefix) {
  Object obj = create_object(doc.getTyped<XmlDocWrapper>()->
                             getClass(), Array(), false);
  c_SimpleXMLElement *elem = obj.getTyped<c_SimpleXMLElement>();
  elem->m_root = root ? root : elem;
  elem->m_doc = doc;
  elem->m_node = node;
  if (node) {
    elem->m_children = create_children(elem->m_root, doc, node, ns, is_prefix);
    elem->m_attributes = collect_attributes(node, ns, is_prefix);
  }
  return obj;
}
static Object create_element(c_SimpleXMLElement *root,
                             CResRef doc, xmlNodePtr node,
                             const String& ns, bool is_prefix) {
  Object obj = create_object(doc.getTyped<XmlDocWrapper>()->
                             getClass(), Array(), false);
  c_SimpleXMLElement *elem = obj.getTyped<c_SimpleXMLElement>();
  elem->m_root = root ? root : elem;
  elem->m_doc = doc;
  elem->m_node = node;
  if (node) {
    elem->m_children = create_children(elem->m_root, doc, node, ns, is_prefix);
    elem->m_attributes = collect_attributes(node, ns, is_prefix);
  }
  return obj;
}