コード例 #1
0
ファイル: xml_document.c プロジェクト: yhara/nokogiri
static void dealloc(xmlDocPtr doc)
{
  NOKOGIRI_DEBUG_START(doc);

  nokogiriTuplePtr tuple = doc->_private;
  xmlNodeSetPtr node_set = tuple->unlinkedNodes;

  int j ;
  for(j = 0 ; j < node_set->nodeNr ; j++) {
    xmlNodePtr node = node_set->nodeTab[j];
    switch(node->type)
    {
      case XML_ATTRIBUTE_NODE:
        xmlFreePropList(node);
        break;
      default:
        if(node->parent == NULL) {
          xmlAddChild((xmlNodePtr)doc, node);
        }
    }
  }

  if (node_set->nodeTab != NULL)
    xmlFree(node_set->nodeTab);
  xmlFree(node_set);

  free(doc->_private);
  doc->_private = NULL;
  xmlFreeDoc(doc);

  NOKOGIRI_DEBUG_END(doc);
}
コード例 #2
0
ファイル: XMLElement.cpp プロジェクト: ASP1234/Scilabv5.5.2
void XMLElement::setAttributes(const XMLAttr & attrs) const
{
    xmlNode *attrNode = attrs.getElement().getRealNode();
    if (node != attrNode)
    {
        xmlFreePropList(node->properties);
        node->properties = 0;
        xmlCopyPropList(node, attrNode->properties);
    }
}
コード例 #3
0
static int dealloc_node_i(xmlNodePtr key, xmlNodePtr node, xmlDocPtr doc)
{
    switch(node->type) {
    case XML_ATTRIBUTE_NODE:
        xmlFreePropList((xmlAttrPtr)node);
        break;
    default:
        if(node->parent == NULL) {
            xmlAddChild((xmlNodePtr)doc, node);
        }
    }
    return ST_CONTINUE;
}
コード例 #4
0
ファイル: xml-entry.c プロジェクト: GNOME/gconf
void
entry_sync_to_node (Entry* e)
{
  g_return_if_fail(e != NULL);
  g_return_if_fail(e->node != NULL);
  
  if (!e->dirty)
    return;

  /* Unset all properties, so we don't have old cruft. */
  if (e->node->properties)
    xmlFreePropList(e->node->properties);
  e->node->properties = NULL;
  
  my_xmlSetProp(e->node, "name", e->name);

  if (e->mod_time != 0)
    {
      gchar* str = g_strdup_printf("%u", (guint)e->mod_time);
      my_xmlSetProp(e->node, "mtime", str);
      g_free(str);
    }
  else
    my_xmlSetProp(e->node, "mtime", NULL); /* Unset */

  /* OK if schema_name is NULL, then we unset */
  my_xmlSetProp(e->node, "schema", e->schema_name);

  /* OK if mod_user is NULL, since it unsets */
  my_xmlSetProp(e->node, "muser", e->mod_user);

  if (e->cached_value)
    node_set_value(e->node, e->cached_value);
  else
    node_unset_value(e->node);
  
  e->dirty = FALSE;
}