static Object create_text(c_SimpleXMLElement *root,
                          CResRef doc, xmlNodePtr node,
                          const String& value, const String& ns,
                          bool is_prefix, bool free_text) {
  Object obj = create_object(doc.getTyped<XmlDocWrapper>()->
                             getClass(), Array(), false);
  c_SimpleXMLElement *elem = obj.getTyped<c_SimpleXMLElement>();
  elem->m_root = root;
  elem->m_doc = doc;
  elem->m_node = node->parent; // assign to parent, not node
  elem->m_children.set(0, value);
  elem->m_is_text = true;
  elem->m_free_text = free_text;
  elem->m_attributes = collect_attributes(node->parent, ns, is_prefix);
  return obj;
}
static Object create_text(c_SimpleXMLElement *root,
                          CResRef doc, xmlNodePtr node,
                          const String& value, const String& ns,
                          bool is_prefix, bool free_text) {
  Object obj = create_object(doc.getTyped<XmlDocWrapper>()->
                             getClass(), Array(), false);
  c_SimpleXMLElement *elem = obj.getTyped<c_SimpleXMLElement>();
  elem->m_root = root;
  elem->m_doc = doc;
  elem->m_node = node->parent;  
  elem->m_children.set(0, value);
  elem->m_is_text = true;
  elem->m_free_text = free_text;
  elem->m_attributes = collect_attributes(node->parent, ns, is_prefix);
  return obj;
}