这篇教程C++ xmlFreeNode函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中xmlFreeNode函数的典型用法代码示例。如果您正苦于以下问题:C++ xmlFreeNode函数的具体用法?C++ xmlFreeNode怎么用?C++ xmlFreeNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了xmlFreeNode函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: write_book_partsgbooleanwrite_book_parts (FILE* out, QofBook* book){ xmlNodePtr domnode, slotsnode; domnode = guid_to_dom_tree (book_id_string, qof_book_get_guid (book)); xmlElemDump (out, NULL, domnode); xmlFreeNode (domnode); if (ferror (out) || fprintf (out, "/n") < 0) return FALSE; slotsnode = qof_instance_slots_to_dom_tree (book_slots_string, QOF_INSTANCE (book)); if (slotsnode) { xmlElemDump (out, NULL, slotsnode); xmlFreeNode (slotsnode); if (ferror (out) || fprintf (out, "/n") < 0) return FALSE; } return TRUE;}
开发者ID:Bob-IT,项目名称:gnucash,代码行数:26,
示例2: command_gda_report_iter_run/* * COMMAND: <gda_report_section> * * Creates copies of its contents, one copy per row in the new run context's * data model. * * uses node's contents: yes * requested attributes: none * * REM: either "query_name" or a <gda_report_query> sub node must be provided to create a data model. */static gbooleancommand_gda_report_iter_run (GdaReportEngine *engine, xmlNodePtr node, GSList **created_nodes, RunContext *context, GError **error){ if (!context || !context->iter) return TRUE; gda_data_model_iter_move_next (context->iter); while (gda_data_model_iter_is_valid (context->iter)) { xmlNodePtr dup, child; dup = xmlCopyNode (node, 1); if (!real_run_at_node (engine, dup->children, context, error)) { xmlFreeNode (dup); return FALSE; } else { for (child = dup->children; child; child = dup->children) { xmlUnlinkNode (child); *created_nodes = g_slist_prepend (*created_nodes, child); } } xmlFreeNode (dup); gda_data_model_iter_move_next (context->iter); } *created_nodes = g_slist_reverse (*created_nodes); return TRUE;}
开发者ID:arthurnn,项目名称:libgda,代码行数:41,
示例3: cleanup_xml_node/* removes all empty text, comments and other insignoficant nodes */static void cleanup_xml_node(xmlNodePtr node) { xmlNodePtr trav; xmlNodePtr del = NULL; trav = node->children; while (trav != NULL) { if (del != NULL) { xmlUnlinkNode(del); xmlFreeNode(del); del = NULL; } if (trav->type == XML_TEXT_NODE) { if (is_blank(trav->content)) { del = trav; } } else if ((trav->type != XML_ELEMENT_NODE) && (trav->type != XML_CDATA_SECTION_NODE)) { del = trav; } else if (trav->children != NULL) { cleanup_xml_node(trav); } trav = trav->next; } if (del != NULL) { xmlUnlinkNode(del); xmlFreeNode(del); }}
开发者ID:191919,项目名称:hhvm,代码行数:29,
示例4: real_run_at_node/* * Interprets nodes from @topnode and for all of @topnode's next siblings */static gbooleanreal_run_at_node (GdaReportEngine *engine, xmlNodePtr topnode, RunContext *context, GError **error){ xmlNodePtr node; xmlNodePtr next_node = NULL; for (node = topnode; node; node = next_node) { next_node = node->next; if (!strncmp ((gchar *) node->name, "gda_report", 10)) { GSList *created_nodes = NULL; gboolean cmd_res = TRUE; gsize i; gboolean command_found = FALSE; for (i = 0; i < sizeof (commands) / sizeof (EngineCommand); i++) { EngineCommand *ec = (EngineCommand *) &(commands [i]); if (ec->has_prefix) { if (!strcmp (((gchar *) node->name) + 10, ec->tag_name + 10)) { command_found = TRUE; if (ec->func) cmd_res = (ec->func) (engine, node, &created_nodes, context, error); break; } } } if (!command_found) { /* gda_ node not implemented */ TO_IMPLEMENT; g_warning ("Engine command '%s' is not yet implemented", (gchar *) node->name); } if (created_nodes) { /* put @node's contents before @node */ GSList *list; for (list = created_nodes; list; list = list->next) { next_node = xmlAddPrevSibling (node, (xmlNodePtr) list->data); g_assert (next_node); } g_slist_free (created_nodes); /* destroy @node */ xmlUnlinkNode (node); xmlFreeNode (node); next_node = next_node->next; } else { /* destroy @node */ xmlUnlinkNode (node); xmlFreeNode (node); } if (!cmd_res) return FALSE; } else if (node->children) { if (!real_run_at_node (engine, node->children, context, error)) return FALSE; } } return TRUE;}
开发者ID:arthurnn,项目名称:libgda,代码行数:63,
示例5: gda_report_engine_set_propertystatic voidgda_report_engine_set_property (GObject *object, guint param_id, const GValue *value, GParamSpec *pspec){ GdaReportEngine *eng; eng = GDA_REPORT_ENGINE (object); if (eng->priv) { switch (param_id) { case PROP_SPEC_NODE: { if (eng->priv->spec) { xmlFreeNode (eng->priv->spec); eng->priv->spec = NULL; } eng->priv->spec = g_value_get_pointer (value); break; } case PROP_SPEC_STRING: { xmlDocPtr doc; doc = xmlParseDoc (BAD_CAST g_value_get_string (value)); if (doc) { if (eng->priv->spec) xmlFreeNode (eng->priv->spec); eng->priv->spec = xmlDocGetRootElement (doc); xmlUnlinkNode (eng->priv->spec); if (eng->priv->doc) xmlFreeDoc (eng->priv->doc); eng->priv->doc = doc; } break; } case PROP_SPEC_FILE: { xmlDocPtr doc; doc = xmlParseFile (g_value_get_string (value)); if (doc) { if (eng->priv->spec) xmlFreeNode (eng->priv->spec); eng->priv->spec = xmlDocGetRootElement (doc); xmlUnlinkNode (eng->priv->spec); if (eng->priv->doc) xmlFreeDoc (eng->priv->doc); eng->priv->doc = doc; } break; } case PROP_OUTPUT_DIR: g_free (eng->priv->output_dir); eng->priv->output_dir = g_value_dup_string (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); break; } }}
开发者ID:UIKit0,项目名称:libgda,代码行数:59,
示例6: node2xml/* Root is not converted to xmlNodePtr, we skip immediately to children */static intnode2xml(xmlNodePtr *xml_node, freesasa_node *node, int exclude_type, int options){ freesasa_node *child; xmlNodePtr xml_child = NULL; assert(xml_node); assert(node); child = freesasa_node_children(node); *xml_node = NULL; if (freesasa_node_type(node) == exclude_type) return FREESASA_SUCCESS; switch (freesasa_node_type(node)) { case FREESASA_NODE_STRUCTURE: *xml_node = structure2xml(node, options); break; case FREESASA_NODE_CHAIN: *xml_node = chain2xml(node, options); break; case FREESASA_NODE_RESIDUE: *xml_node = residue2xml(node, options); break; case FREESASA_NODE_ATOM: *xml_node = atom2xml(node, options); break; case FREESASA_NODE_ROOT: default: assert(0 && "tree illegal"); } if (*xml_node == NULL) return fail_msg("error creating XML-node"); /* simplify? */ while (child != NULL) { if (node2xml(&xml_child, child, exclude_type, options) == FREESASA_FAIL) { return fail_msg(""); } if (xml_child != NULL && xmlAddChild(*xml_node, xml_child) == NULL) { xmlFreeNode(*xml_node); xmlFreeNode(xml_child); return fail_msg(""); } child = freesasa_node_next(child); } return FREESASA_SUCCESS;}
开发者ID:mittinatten,项目名称:freesasa,代码行数:55,
示例7: structure2xmlstatic xmlNodePtrstructure2xml(const freesasa_node *node, int options){ xmlNodePtr xml_node = NULL, xml_area = NULL; char buf[20]; const freesasa_selection **selections; assert(node); selections = freesasa_node_structure_selections(node); xml_node = xmlNewNode(NULL, BAD_CAST "structure"); if (xml_node == NULL) { fail_msg(""); return NULL; } if (xmlNewProp(xml_node, BAD_CAST "chains", BAD_CAST freesasa_node_structure_chain_labels(node)) == NULL) { fail_msg(""); goto cleanup; } sprintf(buf, "%d", freesasa_node_structure_model(node)); if (xmlNewProp(xml_node, BAD_CAST "model", BAD_CAST buf) == NULL) { fail_msg(""); goto cleanup; } xml_area = nodearea2xml(freesasa_node_area(node), "area"); if (xml_area == NULL) { fail_msg(""); goto cleanup; } if (xmlAddChild(xml_node, xml_area) == NULL) { fail_msg(""); xmlFreeNode(xml_area); goto cleanup; } if (selections) { if (add_selections_to_xmlNode(selections, xml_node) == NULL) { fail_msg(""); goto cleanup; } } return xml_node; cleanup: xmlFreeNode(xml_node); return NULL;}
开发者ID:mittinatten,项目名称:freesasa,代码行数:54,
示例8: xmlUnlinkNode/*Remove - removes element from xml tree*/void CXMLElement::Remove(){ if (!isinited()) return; xmlUnlinkNode(element); xmlFreeNode(element); element = NULL;}
开发者ID:alilloyd,项目名称:livecode,代码行数:8,
示例9: xmlNodeGetContentvoidLocal::Presentity::rename_group (const std::string old_name, const std::string new_name){ bool old_name_present = false; bool already_in_new_name = false; std::set<xmlNodePtr> nodes_to_remove; /* remove the old name's node * and check if we aren't already in the new name's group */ for (xmlNodePtr child = node->children ; child != NULL ; child = child->next) { if (child->type == XML_ELEMENT_NODE && child->name != NULL) { if (xmlStrEqual (BAD_CAST ("group"), child->name)) { xmlChar* xml_str = xmlNodeGetContent (child); if (xml_str != NULL) { if (!xmlStrcasecmp ((const xmlChar*)old_name.c_str (), xml_str)) { nodes_to_remove.insert (child); // don't free what we loop on! old_name_present = true; } if (!xmlStrcasecmp ((const xmlChar*)new_name.c_str (), xml_str)) { already_in_new_name = true; } xmlFree (xml_str); } } } } // ok, now we can clean up! for (std::set<xmlNodePtr>::iterator iter = nodes_to_remove.begin (); iter != nodes_to_remove.end (); ++iter) { xmlUnlinkNode (*iter); xmlFreeNode (*iter); } if (old_name_present && !already_in_new_name) { xmlNewChild (node, NULL, BAD_CAST "group", BAD_CAST robust_xmlEscape (node->doc, new_name).c_str ()); } updated (); trigger_saving ();}
开发者ID:Klom,项目名称:ekiga,代码行数:60,
示例10: switchbool gpl::xml::eraseNodeByXPath(){ if (m_xml->resource == NULL) return false; //cout<<"resource->type:"<<m_xml->resource->type<<endl; switch (m_xml->resource->type) { case XPATH_NODESET://Object is a Node Set if (m_xml->resource->nodesetval == NULL) return false; xmlNodePtr cur; //取得第一个节点 if ((cur = (*(m_xml->resource->nodesetval->nodeTab))) == NULL) return true; xmlUnlinkNode(cur); xmlFreeNode(cur); cur = NULL; break; case XPATH_XSLT_TREE://Object is an XSLT value tree case XPATH_BOOLEAN://Object is a Boolean case XPATH_NUMBER://Object is a number case XPATH_STRING://Object is a string case XPATH_POINT://Object is a point case XPATH_RANGE://是一个范围 case XPATH_LOCATIONSET://Object is a Location Set case XPATH_USERS://Object is user defined case XPATH_UNDEFINED://Object is uninitialized return false; break; } return true;}
开发者ID:zhenyouluo,项目名称:GPL,代码行数:33,
示例11: remove_doc_from_content_liststatic void remove_doc_from_content_list(xmlNodePtr cl_node, struct IdTab *id_tab, int start, int end){ xmlNodePtr node, next; char *str_id; int id, i; if (cl_node == NULL) return; for(node = cl_node; node != NULL; node = next) { next = node->next; if (node->type == XML_ELEMENT_NODE && !xmlStrcmp(node->name, (xmlChar *)"doc")) { str_id = (char *)xmlGetProp(node, (xmlChar *)"docid"); id = atoi(str_id); xmlFree(str_id); for(i = start; id_tab[i].id != id && i < end; i++) ; if (i < end && id_tab[i].id == id) { xmlUnlinkNode(node); xmlFreeNode((void *)node); } } else remove_doc_from_content_list(node->children, id_tab, start, end); }}
开发者ID:Distrotech,项目名称:scrollkeeper,代码行数:34,
示例12: PatchCamFlags virtual bool PatchCamFlags(xmlDocPtr doc, const char *uuid, const char *slot, const char *flags) { bool uuid_match=false; bool flags_set =false; xmlNode *node = xmlDocGetRootElement(doc); node = node ? node->children : NULL; while(node && xmlStrcmp(node->name, (const xmlChar *)"Description")) node=node->next; node = node ? node->children : NULL; while(node) { if(node && !xmlStrcmp(node->name, (const xmlChar *)"component")) { xmlNode *item = node->children; while(item && xmlStrcmp(item->name, (const xmlChar *)"Description")) { item = item->next; } // while xmlChar *about = item ? xmlGetProp(item, (const xmlChar *)"about") : NULL; if(about) { if (!xmlStrcmp(about, (const xmlChar *)"Platform")) { xmlNode *sub = item->children; while(sub) { if(!xmlStrcmp(sub->name, (const xmlChar *)"UUID")) { xmlChar *value=xmlNodeListGetString(doc, sub->children, 1); if(value) { uuid_match=!xmlStrcmp(value, (const xmlChar *)uuid); xmlFree(value); } // if } // if sub = sub->next; } // while } else if(!xmlStrcmp(about, (const xmlChar *)"CAM")) { xmlNode *sub = item->children; while(sub) { if(!xmlStrcmp(sub->name, (const xmlChar *)"Slot")) { xmlChar *value=xmlNodeListGetString(doc, sub->children, 1); if(value) { if (!xmlStrcmp(value, (const xmlChar *)slot)) { xmlNode *tst = item->children; while(tst) { if(!xmlStrcmp(tst->name, (const xmlChar *)"Flags")) { xmlReplaceNode(tst, xmlNewChild(item, xmlSearchNs(doc, tst, (const xmlChar *)"prf"), (const xmlChar *)"Flags", (const xmlChar *)flags)); xmlFreeNode(tst); flags_set=true; tst = NULL; continue; } // if tst = tst->next; } // while } // if xmlFree(value); } // if } // if sub = sub->next; } // while } // if xmlFree(about); } // if } // if node = node->next; } // while return uuid_match && flags_set; }; // PatchCamFlags
开发者ID:suborb,项目名称:reelvdr,代码行数:60,
示例13: _store void qt_dbtableview_impl :: _store() { if (!(_model && _parent && _xml)) return; if (!_model->columnCount()) return; xpath_object_ptr tmp(0); string expr = _tag_model+ "/columns/column[@number=/"%s/"]"; for(int i=0; i<_model->columnCount(); ++i) { string s(expr); s.replace(s.find("%s"), 2, int_to_str(i)); tmp = _xml->xpath_eval_expr((s + "/width[text()!=/"/"]").c_str()); if (tmp->size()) { tmp->set_content(0, int_to_str(_parent->columnWidth(i)).c_str()); continue; } tmp = _xml->xpath_eval_expr(s.c_str()); if (tmp->size()) { xmlNodePtr node = xmlNewNode(NULL, (xmlChar*)"width"); if (!node) { _lprintf(LOG_ERR, "can't create xml node/n"); continue; } xmlNodeAddContent(node, (xmlChar*)int_to_str(_parent->columnWidth(i)).c_str()); try { tmp->insert_node(0, node); } catch (xpath_error& e) { xmlFreeNode(node); _lprintf(LOG_ERR, "%s/n", e.what()); } } } _xml->save(); }
开发者ID:sblab,项目名称:libeast,代码行数:34,
示例14: gda_report_engine_disposestatic voidgda_report_engine_dispose (GObject *object){ GdaReportEngine *eng = (GdaReportEngine *) object; g_return_if_fail (GDA_IS_REPORT_ENGINE (eng)); /* free memory */ if (eng->priv) { if (eng->priv->objects) { g_hash_table_destroy (eng->priv->objects); eng->priv->objects = NULL; } if (eng->priv->doc) { xmlFreeDoc (eng->priv->doc); eng->priv->doc = NULL; } if (eng->priv->spec) { xmlFreeNode (eng->priv->spec); eng->priv->spec = NULL; } g_free (eng->priv->output_dir); g_free (eng->priv); eng->priv = NULL; } /* chain to parent class */ parent_class->dispose (object);}
开发者ID:UIKit0,项目名称:libgda,代码行数:33,
示例15: getListNode void XMLNodeList::replaceAtIndex(int index, const XMLElement & elem) { xmlNode *n = getListNode(index); if (n && n != elem.getRealNode()) { if (index == 1) { scope->unregisterNodeListPointer(parent->children); } xmlNode *previous = n->prev; xmlNode *next = n->next; xmlNode *cpy = xmlCopyNode(elem.getRealNode(), 1); xmlUnlinkNode(cpy); xmlReplaceNode(n, cpy); xmlFreeNode(n); prevNode = cpy; cpy->prev = previous; cpy->next = next; if (index == 1) { scope->registerPointers(parent->children, this); } } }
开发者ID:vinayrajchoudhary,项目名称:scilab,代码行数:26,
示例16: remove_supported/** * /brief Remove input plugin from supportedCollectors tag * * /param info tool configuration * /return 0 on success */int remove_supported(conf_info_t *info){ int i; xmlNodePtr children1; xmlXPathObjectPtr xpath_obj_file = eval_xpath(info, TAG_SUPPORTED); if (!xpath_obj_file) { return 1; } for (i = 0; i < xpath_obj_file->nodesetval->nodeNr; i++) { children1 = xpath_obj_file->nodesetval->nodeTab[i]->children; while (children1) { if ((!strncmp ((char*) children1->name, "name", strlen ("name") + 1)) && (!xmlStrncmp (children1->children->content, (xmlChar *) info->name, xmlStrlen ((xmlChar *)info->name) + 1))) { /* element found*/ xmlUnlinkNode(children1); xmlFreeNode(children1); return 0; } children1 = children1->next; } } return 0;}
开发者ID:VisBlank,项目名称:ipfixcol,代码行数:31,
示例17: delete_eag_onelevel/*delete one level xml node*/int delete_eag_onelevel(char *fpath,char *node_name,char *attribute,char *ruler){ xmlDocPtr pdoc = NULL; xmlNodePtr pcurnode = NULL; char *psfilename; int flag=-1; psfilename = fpath; pdoc = xmlReadFile(psfilename,"utf-8",256); if(NULL == pdoc) { return 1; } pcurnode = xmlDocGetRootElement(pdoc); pcurnode = pcurnode->xmlChildrenNode; xmlNodePtr propNodePtr = pcurnode; while (NULL != pcurnode) { if (!xmlStrcmp(pcurnode->name, BAD_CAST node_name)) { propNodePtr = pcurnode; xmlChar* szAttr = xmlGetProp(propNodePtr,BAD_CAST attribute); if(!xmlStrcmp(szAttr,BAD_CAST ruler)) { xmlNodePtr tempNode; tempNode = pcurnode->next; xmlUnlinkNode(pcurnode); xmlFreeNode(pcurnode); pcurnode = tempNode; flag=0; continue; } xmlFree(szAttr); } pcurnode = pcurnode->next; } xmlSaveFile(fpath,pdoc); return flag;}
开发者ID:inibir,项目名称:daemongroup,代码行数:61,
示例18: do_remove_emptyint do_remove_empty(xmlNode* node) { xmlNode* n; int i, is_empty, len; xmlChar* val; for(n = node; n; n = n->next) { if(n->type == XML_TEXT_NODE) { val = xmlNodeGetContent(n); len = strlen((const char*)val); is_empty = 1; for(i = 0; i < len; i++) { if(!isspace(val[i])) { is_empty = 0; } } xmlFree(val); if(is_empty) { xmlUnlinkNode(n); xmlFreeNode(n); return 1; } } } for(n = node; n; n = n->next) { if(n->type == XML_ELEMENT_NODE) { do { }while(do_remove_empty(n->children)); } } return 0;}
开发者ID:redsox38,项目名称:panoptes,代码行数:35,
示例19: rxml_node_remove_exstatic VALUE rxml_node_remove_ex(VALUE self){ xmlNodePtr xnode, xresult; xnode = rxml_get_xnode(self); /* First unlink the node from its parent. */ xmlUnlinkNode(xnode); /* Now copy the node we want to remove and make the current Ruby object point to it. We do this because a node has a number of dependencies on its parent document - its name (if using a dictionary), entities, namespaces, etc. For a node to live on its own, it needs to get its own copies of this information.*/ xresult = xmlDocCopyNode(xnode, NULL, 1); /* Now free the original node. */ xmlFreeNode(xnode); /* Now wrap the new node */ RDATA(self)->data = xresult; xresult->_private = (void*) self; /* Now return the removed node so the user can do something with it.*/ return self;}
开发者ID:nikitug,项目名称:libxml-ruby,代码行数:27,
示例20: design_tolerance_to_xml_nodexmlNodePtr design_tolerance_to_xml_node(design_tolerance_s *t){ xmlNodePtr n = NULL; xmlNodePtr vn = NULL; char sn[MAX_SN]; // Sanity check parameters. assert(t); n = xmlNewNode(NULL, BAD_CAST "tolerance"); if (!n) return NULL; vn = vertex_to_xml_node(t->location); if (vn) { xmlAddChild(n, xmlCopyNode(vn, 1)); xmlFreeNode(vn); } snprintf(sn, MAX_SN, "%f", t->text_size); xmlNewChild(n, NULL, BAD_CAST "text-size", BAD_CAST sn); snprintf(sn, MAX_SN, "%f", t->plus); xmlNewChild(n, NULL, BAD_CAST "plus", BAD_CAST sn); snprintf(sn, MAX_SN, "%f", t->minus); xmlNewChild(n, NULL, BAD_CAST "minus", BAD_CAST sn); snprintf(sn, MAX_SN, "%d", t->precision); xmlNewChild(n, NULL, BAD_CAST "precision", BAD_CAST sn); // Return RETVAL return n;}
开发者ID:PatrickHead,项目名称:blue,代码行数:34,
示例21: gnc_order_end_handlerstatic gbooleangnc_order_end_handler(gpointer data_for_children, GSList* data_from_children, GSList* sibling_data, gpointer parent_data, gpointer global_data, gpointer *result, const gchar *tag){ GncOrder *order; xmlNodePtr tree = (xmlNodePtr)data_for_children; gxpf_data *gdata = (gxpf_data*)global_data; QofBook *book = gdata->bookdata; if (parent_data) { return TRUE; } /* OK. For some messed up reason this is getting called again with a NULL tag. So we ignore those cases */ if (!tag) { return TRUE; } g_return_val_if_fail(tree, FALSE); order = dom_tree_to_order(tree, book); if (order != NULL) { gdata->cb(tag, gdata->parsedata, order); } xmlFreeNode(tree); return order != NULL;}
开发者ID:mlq,项目名称:gnucash,代码行数:35,
示例22: test_dom_tree_to_guidstatic voidtest_dom_tree_to_guid(void){ int i; for (i = 0; i < 20; i++) { GncGUID *test_guid1; GncGUID *test_guid2; xmlNodePtr test_node; test_guid1 = get_random_guid(); if (!(test_node = guid_to_dom_tree("test-guid", test_guid1))) { failure_args("guid_to_dom_tree", __FILE__, __LINE__, "conversion to dom tree failed"); } test_guid2 = dom_tree_to_guid(test_node); do_test(guid_equal(test_guid1, test_guid2), "dom_tree_to_guid" ); xmlFreeNode(test_node); g_free(test_guid1); g_free(test_guid2); }}
开发者ID:BenBergman,项目名称:gnucash,代码行数:28,
示例23: xmlFreeNodevoid Node::rebind(_xmlNode *newNode){ if ( _xml == newNode ) return; typedef LibXML2Private<Node> _Private; if ( _xml != nullptr ) { if ( _xml->parent == nullptr && _xml->next == nullptr && _xml->prev == nullptr ) { xmlNodePtr __n = _xml; this->release(); xmlFreeNode(__n); // releases libxml's reference to this object } } _xml = newNode; typedef std::shared_ptr<Node> NodePtr; if (_xml->_private != nullptr && *((unsigned int*)(_xml->_private)) == _READIUM_XML_SIGNATURE) { // reassign the bridge ptr on the libxml node _Private* ptr = reinterpret_cast<_Private*>(newNode->_private); ptr->__ptr = shared_from_this(); } else if (_xml->_private != nullptr) { auto ptr = shared_from_this(); _xml->_private = new _Private(ptr); }}
开发者ID:Hasimir,项目名称:readium-sdk,代码行数:32,
示例24: osync_traceOSyncXMLField *osync_xmlfield_new(OSyncXMLFormat *xmlformat, const char *name, OSyncError **error){ xmlNodePtr node = NULL; OSyncXMLField *xmlfield = NULL; osync_trace(TRACE_ENTRY, "%s(%p, %s, %p)", __func__, xmlformat, name, error); osync_assert(xmlformat); osync_assert(name); node = xmlNewTextChild(xmlDocGetRootElement(xmlformat->doc), NULL, BAD_CAST name, NULL); xmlfield = osync_xmlfield_new_node(xmlformat, node, error); if(!xmlfield) { xmlUnlinkNode(node); xmlFreeNode(node); osync_trace(TRACE_EXIT_ERROR, "%s: %s" , __func__, osync_error_print(error)); return NULL; } /* XMLFormat entry got added - not sure if it is still sorted */ osync_xmlformat_set_unsorted(xmlformat); /* This XMLField has no keys, so it's for sure it's sorted */ xmlfield->sorted = TRUE; osync_trace(TRACE_EXIT, "%s: %p", __func__, xmlfield); return xmlfield;}
开发者ID:ianmartin,项目名称:autoimportopensync,代码行数:27,
示例25: apply_temporary_additionstatic GUPnPDIDLLiteFragmentResultapply_temporary_addition (DocNode *modified, xmlNodePtr sibling, xmlNodePtr new_node, XSDData *xsd_data){ xmlNodePtr mod_sibling; xmlNodePtr new_node_copy = av_xml_util_copy_node (new_node); if (sibling->doc == modified->doc) mod_sibling = sibling; else mod_sibling = av_xml_util_find_node (modified->node, sibling); if (mod_sibling == NULL) return GUPNP_DIDL_LITE_FRAGMENT_RESULT_UNKNOWN_ERROR; xmlUnlinkNode (new_node_copy); if (xmlAddNextSibling (mod_sibling, new_node_copy) == NULL) { xmlFreeNode (new_node_copy); return GUPNP_DIDL_LITE_FRAGMENT_RESULT_UNKNOWN_ERROR; } if (!xsd_data_validate_doc (xsd_data, modified->doc)) return GUPNP_DIDL_LITE_FRAGMENT_RESULT_NEW_INVALID; return GUPNP_DIDL_LITE_FRAGMENT_RESULT_OK;}
开发者ID:GNOME,项目名称:gupnp-av,代码行数:30,
示例26: osync_xmlfield_freevoid osync_xmlfield_free(OSyncXMLField *xmlfield){ osync_assert(xmlfield); xmlFreeNode(xmlfield->node); g_free(xmlfield);}
开发者ID:ianmartin,项目名称:autoimportopensync,代码行数:7,
示例27: test_dom_tree_to_commodity_refstatic voidtest_dom_tree_to_commodity_ref(void){ int i; for (i = 0; i < 20; i++) { gnc_commodity *test_com1; gchar *test_str1; gchar *test_str2; gnc_commodity *test_com2; xmlNodePtr test_node; QofBook *book; book = qof_book_new (); test_str1 = get_random_string(); test_str2 = get_random_string(); test_com1 = gnc_commodity_new(book, NULL, test_str1, test_str2, NULL, 0); test_node = commodity_ref_to_dom_tree("test-com", test_com1); test_com2 = dom_tree_to_commodity_ref_no_engine(test_node, book); do_test(gnc_commodity_equiv(test_com1, test_com2), "dom_tree_to_commodity_ref_no_engine"); xmlFreeNode(test_node); gnc_commodity_destroy(test_com1); gnc_commodity_destroy(test_com2); g_free(test_str1); g_free(test_str2); qof_book_destroy (book); }}
开发者ID:BenBergman,项目名称:gnucash,代码行数:35,
示例28: xml_get_and_trim_names/* Adapted from yelp-toc-pager.c */static xmlChar *xml_get_and_trim_names (xmlNodePtr node){ xmlNodePtr cur; xmlChar *keep_lang = NULL; xmlChar *value; int j, keep_pri = INT_MAX; const gchar * const * langs = g_get_language_names (); value = NULL; for (cur = node->children; cur; cur = cur->next) { if (! xmlStrcmp (cur->name, GVC_SOUND_NAME)) { xmlChar *cur_lang = NULL; int cur_pri = INT_MAX; cur_lang = xmlNodeGetLang (cur); if (cur_lang) { for (j = 0; langs[j]; j++) { if (g_str_equal (cur_lang, langs[j])) { cur_pri = j; break; } } } else { cur_pri = INT_MAX - 1; } if (cur_pri <= keep_pri) { if (keep_lang) xmlFree (keep_lang); if (value) xmlFree (value); value = xmlNodeGetContent (cur); keep_lang = cur_lang; keep_pri = cur_pri; } else { if (cur_lang) xmlFree (cur_lang); } } } /* Delete all GVC_SOUND_NAME nodes */ cur = node->children; while (cur) { xmlNodePtr this = cur; cur = cur->next; if (! xmlStrcmp (this->name, GVC_SOUND_NAME)) { xmlUnlinkNode (this); xmlFreeNode (this); } } return value;}
开发者ID:City-busz,项目名称:mate-media,代码行数:61,
注:本文中的xmlFreeNode函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ xmlFreeParserCtxt函数代码示例 C++ xmlFreeDoc函数代码示例 |