static Array collect_attributes(xmlNodePtr node, const String& ns, bool is_prefix) {
  assert(node);
  Array attributes = Array::Create();
  if (node->type != XML_ENTITY_DECL) {
    for (xmlAttrPtr attr = node->properties; attr; attr = attr->next) {
      if (match_ns((xmlNodePtr)attr, ns, is_prefix)) {
        String n = String((char*)attr->name, xmlStrlen(attr->name), CopyString);
        attributes.set(n, node_list_to_string(node->doc, attr->children));
      }
    }
  }
  return attributes;
}
static Array collect_attributes(xmlNodePtr node, const String& ns, bool is_prefix) {
  assert(node);
  Array attributes = Array::Create();
  if (node->type != XML_ENTITY_DECL) {
    for (xmlAttrPtr attr = node->properties; attr; attr = attr->next) {
      if (match_ns((xmlNodePtr)attr, ns, is_prefix)) {
        String n = String((char*)attr->name, xmlStrlen(attr->name), CopyString);
        attributes.set(n, node_list_to_string(node->doc, attr->children));
      }
    }
  }
  return attributes;
}