这篇教程C++ xmlCopyNode函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中xmlCopyNode函数的典型用法代码示例。如果您正苦于以下问题:C++ xmlCopyNode函数的具体用法?C++ xmlCopyNode怎么用?C++ xmlCopyNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了xmlCopyNode函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: modifytree// below added for xml merge// removes spaces between # and the textstatic int modifytree(xmlNodePtr* ParentPtr, xmlNodePtr sourceNode){ int notfound = -1; //not found xmlNodePtr child = (*ParentPtr)->xmlChildrenNode, txt = NULL; while (child != NULL) { if ((xmlStrcmp(child->name, (const xmlChar*)"text"))) { if ((!xmlStrcmp(child->name, sourceNode->name))) { xmlNodePtr destNode = xmlCopyNode(sourceNode, 1); xmlNodePtr old = xmlReplaceNode(child, destNode); xmlFreeNode(old); notfound = 0; break; } } else { txt = child; } child = child->next; } if (notfound == -1) { xmlAddChild(*ParentPtr, xmlCopyNode(sourceNode, 1)); xmlAddChild(*ParentPtr, xmlCopyNode(txt, 1)); logger_remotem("LOAD_CONFIG_FILE: Node not found, adding new node: %s", sourceNode->name); } return notfound;}
开发者ID:giacdinh,项目名称:rr_apps,代码行数:34,
示例2: xmlCopyNode bool WaveFunctionFactory::build(xmlNodePtr cur, bool buildtree) { if(cur == NULL) return false; bool attach2Node=false; if(buildtree) { if(myNode == NULL) { myNode = xmlCopyNode(cur,1); } else { attach2Node=true; } } if(targetPsi==0) {//allocate targetPsi and set the name targetPsi = new TrialWaveFunction; targetPsi->setName(myName); app_log() << " Creating a trial wavefunction " << myName << endl; } cur = cur->children; bool success=true; while(cur != NULL) { string cname((const char*)(cur->name)); if (cname == OrbitalBuilderBase::detset_tag) { success = addFermionTerm(cur); } else if (cname == OrbitalBuilderBase::jastrow_tag) { OrbitalBuilderBase *jbuilder = new JastrowBuilder(*targetPtcl,*targetPsi,ptclPool); success = jbuilder->put(cur); addNode(jbuilder,cur); } else if(cname == "agp") {#if defined(QMC_COMPLEX) app_error() << " AGPDeterminant cannot be used with QMC_COMPLEX=1" << endl; return false;#else AGPDeterminantBuilder* agpbuilder = new AGPDeterminantBuilder(*targetPtcl,*targetPsi,ptclPool); success = agpbuilder->put(cur); addNode(agpbuilder,cur);#endif } if(attach2Node) xmlAddChild(myNode,xmlCopyNode(cur,1)); cur = cur->next; } if(OrbitalBuilderBase::print_level>0) { app_log() << " List of optimizable variables " << endl; targetPsi->VarList.print(app_log()); //set to zero so that nothing is written again OrbitalBuilderBase::print_level=0; } return success; }
开发者ID:digideskio,项目名称:qmcpack,代码行数:60,
示例3: xmlCopyDocvoid c_XSLTProcessor::t_importstylesheet(const Object& stylesheet) { xmlDocPtr doc = nullptr; if (stylesheet.instanceof(c_DOMDocument::classof())) { c_DOMDocument *domdoc = stylesheet.getTyped<c_DOMDocument>(); // This doc will be freed by xsltFreeStylesheet. doc = xmlCopyDoc((xmlDocPtr)domdoc->m_node, /*recursive*/ 1); if (doc == nullptr) { raise_error("Unable to import stylesheet"); } } else if (stylesheet.instanceof(c_SimpleXMLElement::classof())) { c_SimpleXMLElement *elem = stylesheet.getTyped<c_SimpleXMLElement>(); // This doc will be freed by xsltFreeStylesheet. doc = xmlNewDoc((const xmlChar*)"1.0"); xmlNodePtr node = xmlCopyNode(elem->node, /*extended*/ 1); if (doc == nullptr || node == nullptr) { raise_error("Unable to import stylesheet"); } xmlDocSetRootElement(doc, node); } else { raise_error("Object must be an instance of DOMDocument or " "SimpleXMLElement"); } if (doc) { m_stylesheet = xsltParseStylesheetDoc(doc); if (m_stylesheet == nullptr) { raise_error("Unable to import stylesheet"); } }}
开发者ID:6api,项目名称:hhvm,代码行数:31,
示例4: node_cloneHRESULT node_clone(xmlnode *This, VARIANT_BOOL deep, IXMLDOMNode **cloneNode){ IXMLDOMNode *node; xmlNodePtr clone; if(!cloneNode) return E_INVALIDARG; clone = xmlCopyNode(This->node, deep ? 1 : 2); if (clone) { xmlSetTreeDoc(clone, This->node->doc); xmldoc_add_orphan(clone->doc, clone); node = create_node(clone); if (!node) { ERR("Copy failed/n"); xmldoc_remove_orphan(clone->doc, clone); xmlFreeNode(clone); return E_FAIL; } *cloneNode = node; } else { ERR("Copy failed/n"); return E_FAIL; } return S_OK;}
开发者ID:RareHare,项目名称:reactos,代码行数:32,
示例5: 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:UIKit0,项目名称:libgda,代码行数:41,
示例6: get_sub_nodestatic xmlNode *get_sub_node (xmlDoc *doc){ xmlNode *node; xmlXPathContext *xpath_ctx; xmlXPathObject * xpath_obj; xpath_ctx = xmlXPathNewContext (doc); xpath_obj = xmlXPathEvalExpression ((xmlChar *) "/osm/node|/osm/way|/osm/relation", xpath_ctx); if (xpath_obj && xpath_obj->nodesetval && xpath_obj->nodesetval->nodeNr > 0) { node = xmlCopyNode (xpath_obj->nodesetval->nodeTab[0], 1); } else { g_warning ("Couldn't find element"); node = NULL; } xmlXPathFreeObject (xpath_obj); xmlXPathFreeContext (xpath_ctx); return node;}
开发者ID:GNOME,项目名称:gnome-maps,代码行数:26,
示例7: xmlCopyNode/**/brief Convert an XML node from the old saved-games.xml format to the new format. * /details * The old saved-games.xml format put all of the Player information in one file. * The new saved-games.xml format only stores some Player information, but * nothing that relies on loading the Simulation. Everything in the old * style format is by itself in a standalone xml file named after the player. * /todo This could save a copy of the old saved-games.xml to a backup location. * /param[in] doc The XML document. * /param[in] xnode The XML Node. * /return A new XML node that represents the PlayerInfo for the Player. */xmlNodePtr PlayerInfo::ConvertOldVersion( xmlDocPtr doc, xmlNodePtr node ) { char buff[256]; xmlDocPtr xmlPtr; xmlNodePtr attr; xmlNodePtr copy = xmlCopyNode( node, 1); string filename = "Resources/Definitions/"+ name +".xml"; LogMsg(INFO, "Converting %s to an xml file: %s ", name.c_str(), filename.c_str() ); xmlPtr = xmlNewDoc( BAD_CAST "1.0" ); xmlDocSetRootElement(xmlPtr, copy); // Version information snprintf(buff, sizeof(buff), "%d", EPIAR_VERSION_MAJOR); xmlNewChild(copy, NULL, BAD_CAST "version-major", BAD_CAST buff); snprintf(buff, sizeof(buff), "%d", EPIAR_VERSION_MINOR); xmlNewChild(copy, NULL, BAD_CAST "version-minor", BAD_CAST buff); snprintf(buff, sizeof(buff), "%d", EPIAR_VERSION_MICRO); xmlNewChild(copy, NULL, BAD_CAST "version-macro", BAD_CAST buff); xmlSaveFormatFileEnc( filename.c_str(), xmlPtr, "ISO-8859-1", 1); xmlNodePtr new_node = xmlNewNode(NULL, BAD_CAST "player"); xmlNewChild(new_node, NULL, BAD_CAST "name", BAD_CAST GetName().c_str() ); xmlNewChild(new_node, NULL, BAD_CAST "file", BAD_CAST filename.c_str() ); if( (attr = FirstChildNamed(copy, "lastLoadTime")) ){ xmlNewChild(new_node, NULL, BAD_CAST "lastLoadTime", BAD_CAST NodeToString(doc,attr).c_str() ); } return new_node;}
开发者ID:DuMuT6p,项目名称:Epiar,代码行数:43,
示例8: xmlDestroyNodeXmlNode& XmlNode::operator =(const XmlNode& n){ if (m_hXml) xmlDestroyNode(m_hXml); m_hXml = xmlCopyNode(n); return *this;}
开发者ID:Seldom,项目名称:miranda-ng,代码行数:7,
示例9: getXMLFrom /// get XML from current object FWXML_API xmlNodePtr getXMLFrom( ::fwData::Object::sptr obj ) { OSLM_DEBUG("GenericXMLTranslator for " << obj->className() << "-" << obj.get() ); // check obj is well realated to RealObject ::boost::shared_ptr<RealData> robj = ::boost::dynamic_pointer_cast<RealData >(obj); SLM_ASSERT("robj not instanced", robj); // create master node with className+id xmlNodePtr node = XMLTranslatorHelper::MasterNode( robj ); // create data information using boost tweaked archive ::boost::archive::fw_xml_oarchive ao_xml(0); { ao_xml.operator&( ::boost::serialization::make_nvp("BoostManagedObject", *robj ) ); // Serialization with pointer generate an NVP (.first with NULL name !!!) } xmlNodePtr boostXML = ao_xml.getXMLNode(); SLM_ASSERT("boostXML not instanced", boostXML); boostXML = boostXML->children; while ( boostXML!=NULL ) { if ( boostXML->type == XML_ELEMENT_NODE ) { xmlAddChild( node, xmlCopyNode(boostXML,1) ); } boostXML = boostXML->next; } xmlFree( ao_xml.getXMLNode() ); return node; }
开发者ID:dragonlet,项目名称:fw4spl,代码行数:35,
示例10: xmlCopyNode/*CopyElement - copies element of other CXMLElementtruecopy - if true this is set to point to element of telement, otherwise this is set to point to a copy of element in telementoutput: telement - xml element to copy from*/void CXMLElement::CopyElement(CXMLElement *telement,Bool truecopy){ if (truecopy) element = xmlCopyNode(telement->GetNodePtr(), 1); else element = telement->GetNodePtr();}
开发者ID:alilloyd,项目名称:livecode,代码行数:12,
示例11: 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,
示例12: 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,
示例13: xmlCopyNode void XMLNodeList::insertAtEnd(const XMLElement & elem) { xmlNode *cpy = xmlCopyNode(elem.getRealNode(), 1); xmlUnlinkNode(cpy); xmlAddChild(parent, cpy); size++; }
开发者ID:vinayrajchoudhary,项目名称:scilab,代码行数:8,
示例14: xmlAddPrevSibling// Inherits XMLSpy generation source function.xmlNodePtr CNode::InternalInsertNodeAt(const tstring& sNamespaceURI, const tstring& sName, int nIndex, CNode& rNode){ rNode.m_pDOMNode = xmlAddPrevSibling( InternalGetAt(Element, sNamespaceURI, sName, nIndex), xmlCopyNode(rNode.m_pDOMNode, 1) ); return rNode.m_pDOMNode;}
开发者ID:ASTL-NICT,项目名称:MCML-OSS,代码行数:10,
示例15: BundleElementExtension::Extension( ::boost::shared_ptr< Bundle > bundle, const std::string & id, const std::string & point, xmlNodePtr xmlNode ): BundleElement ( bundle ), m_id ( id ), m_point ( point ), m_xmlDoc ( xmlNewDoc(BAD_CAST "1.0") ), m_xmlNode ( xmlCopyNode(xmlNode, 1) ), m_validity ( UnknownValidity ){ xmlDocSetRootElement(m_xmlDoc, m_xmlNode);}
开发者ID:corentindesfarges,项目名称:fw4spl,代码行数:10,
示例16: xmlReplaceNode// Inherits XMLSpy generation source function.xmlNodePtr CNode::InternalReplaceNodeAt(const tstring& sNamespaceURI, const tstring& sName, int nIndex, CNode& rNode){ xmlNodePtr pOldNode = rNode.m_pDOMNode; rNode.m_pDOMNode = xmlReplaceNode( InternalGetAt(Element, sNamespaceURI, sName, nIndex), xmlCopyNode(rNode.m_pDOMNode, 1) ); CDoc::ReleaseFragment(pOldNode); return rNode.m_pDOMNode;}
开发者ID:ASTL-NICT,项目名称:MCML-OSS,代码行数:12,
示例17: GetNodexmlNodePtr CSpmXml::Clone(xmlNodePtr pNode, bool bDeep){ pNode = GetNode(pNode); if (0 == pNode) return 0; int nRecursive = 1; if (!bDeep) nRecursive = 2; return xmlCopyNode(pNode, nRecursive);}
开发者ID:smurav,项目名称:gis36,代码行数:12,
示例18: oscap_sprintfxmlNode *oscap_xmlstr_to_dom(xmlNode *parent, const char *elname, const char *content){ char *str = oscap_sprintf("<x xmlns:xhtml='http://www.w3.org/1999/xhtml'>%s</x>", content); xmlDoc *doc = xmlReadMemory(str, strlen(str), NULL, NULL, XML_PARSE_RECOVER | XML_PARSE_NOERROR | XML_PARSE_NOWARNING | XML_PARSE_NONET | XML_PARSE_NSCLEAN); xmlNode *text_node = xmlCopyNode(xmlDocGetRootElement(doc), 1); xmlNodeSetName(text_node, BAD_CAST elname); xmlAddChild(parent, text_node); xmlFreeDoc(doc); oscap_free(str); return text_node;}
开发者ID:galaris,项目名称:openscap,代码行数:12,
示例19: TS_hGetConfigurationData//USAGEMODE HRESULT TS_hGetConfigurationData(BYTE*& pDesBuffer, UINT& nBuffSize)USAGEMODE HRESULT TS_hGetConfigurationData(xmlNodePtr* pxmlNodePtr){ if(g_pomTSExecutorChildWindow != NULL) { return g_pomTSExecutorChildWindow->GetConfigurationData(*pxmlNodePtr); } else { *pxmlNodePtr = xmlCopyNode(m_pXmlConfigNode, 1); return S_OK; }}
开发者ID:bagge,项目名称:busmaster,代码行数:13,
示例20: xmlCopyNodevoid XMLElement::setChildren(const XMLElement & elem) const{ xmlNode *n = elem.getRealNode(); if (n && n->parent != node) { xmlNode *cpy = xmlCopyNode(n, 1); xmlUnlinkNode(cpy); xmlUnlinkNode(node->children); xmlFreeNodeList(node->children); node->children = 0; xmlAddChild(node, cpy); }}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:13,
示例21: duplicate_node/* * call-seq: * dup * * Copy this node */static VALUE duplicate_node(VALUE self){ xmlNodePtr node, dup; Data_Get_Struct(self, xmlNode, node); dup = xmlCopyNode(node, 1); if(dup == NULL) return Qnil; dup->doc = node->doc; assert(node->parent); xmlAddChild(node->parent, dup); return Nokogiri_wrap_xml_node(dup);}
开发者ID:daustin,项目名称:analysis-xml-processor,代码行数:20,
示例22: SLM_ASSERTstd::string XMLParser::toString(xmlNodePtr node){ SLM_ASSERT("node not instanced", node); xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0"); xmlDocSetRootElement ( doc , xmlCopyNode( node, 1 ) ); std::stringstream ss; XMLStream::toStream( doc, ss ); // cleaning xmlFreeDoc( doc ); return ss.str();}
开发者ID:dragonlet,项目名称:fw4spl,代码行数:14,
示例23: xml_node_from_bufxml_node_t * xml_node_from_buf(struct xml_node_ctx *ctx, const char *buf){ xmlDocPtr doc; xmlNodePtr node; doc = xmlParseMemory(buf, strlen(buf)); if (doc == NULL) return NULL; node = xmlDocGetRootElement(doc); node = xmlCopyNode(node, 1); xmlFreeDoc(doc); return (xml_node_t *) node;}
开发者ID:2asoft,项目名称:freebsd,代码行数:14,
示例24: gda_report_engine_run_as_node/** * gda_report_engine_run_as_node * @engine: a #GdaReportEngine object * @error: a place to store errors, or %NULL * * Execute the @engine engine and creates a new xmlNodePtr XML node * * Returns: a new xmlNodePtr or %NULL if an error occurred */xmlNodePtr gda_report_engine_run_as_node (GdaReportEngine *engine, GError **error){ xmlNodePtr retnode; g_return_val_if_fail (GDA_IS_REPORT_ENGINE (engine), NULL); g_return_val_if_fail (engine->priv, NULL); g_return_val_if_fail (engine->priv->spec, NULL); retnode = xmlCopyNode (engine->priv->spec, 1); if (!real_run_at_node (engine, retnode, NULL, error)) { xmlFreeNode (retnode); retnode = NULL; } return retnode;}
开发者ID:UIKit0,项目名称:libgda,代码行数:24,
示例25: xmlCopyNode XMLNode::NodeData * XMLNode::NodeData::detachingClone(){ --m_invRefCount; NodeData *_data = new NodeData; //copy _data->m_content = m_content; _data->m_name = m_name; _data->m_attributes = m_attributes; _data->m_childNodes = m_childNodes; _data->m_node = xmlCopyNode( m_node, 2 ); return _data; }
开发者ID:0of,项目名称:WebOS-Magna,代码行数:15,
示例26: GetXmlNodePtrFromStringxmlNodePtr GetXmlNodePtrFromString( const string& xml_string ) { xmlNodePtr root_node = 0; Xml::DocPtr doc_( xmlParseDoc( BAD_CAST xml_string.c_str() ) ); if ( doc_ ) { root_node = xmlDocGetRootElement( doc_ ); } if ( root_node ) { return xmlCopyNode( root_node, 1 ); } return 0;}
开发者ID:coinhelper,项目名称:coin,代码行数:15,
注:本文中的xmlCopyNode函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ xmlCreatePushParserCtxt函数代码示例 C++ xmlCleanupParser函数代码示例 |