您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ xmlNodeDump函数代码示例

51自学网 2021-06-03 11:46:15
  C++
这篇教程C++ xmlNodeDump函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中xmlNodeDump函数的典型用法代码示例。如果您正苦于以下问题:C++ xmlNodeDump函数的具体用法?C++ xmlNodeDump怎么用?C++ xmlNodeDump使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了xmlNodeDump函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: list_to_xml1

char * list_to_xml1(list_t list) {    xmlDoc * doc = NULL;	xmlNode * rootNode = NULL;	xmlNode * studentNode = NULL;	xmlNode * groupNode = NULL;	char strBuf[100];	char * text = malloc(sizeof (char) * 10000);	doc = xmlNewDoc("1.0");	rootNode = xmlNewNode(NULL, "directors");	for (int i = 0;i < list_size(list); i++)	{		if (list_get(list, i) == NULL)			continue;		puts(((struct admin_s *)list_get(list, i))->name);		xmlDocSetRootElement(doc, rootNode);		studentNode = xmlNewChild(rootNode, NULL, "director", NULL);		xmlNewChild(studentNode, NULL, "name", ((struct admin_s *)list_get(list, i))->name);		xmlNewChild(studentNode, NULL, "surname", ((struct admin_s *)list_get(list, i))->surname);		sprintf(strBuf, "%i", ((struct admin_s *)list_get(list, i))->buget);		xmlNewChild(studentNode, NULL, "buget", strBuf);		sprintf(strBuf, "%llf", ((struct admin_s *)list_get(list, i))->years);		xmlNewChild(studentNode, NULL, "years", strBuf);		xmlNewChild(studentNode, NULL, "birthdate", ((struct admin_s *)list_get(list, i))->birthdate);	}	xmlBuffer * bufferPtr = xmlBufferCreate();		xmlNodeDump(bufferPtr, NULL, (xmlNode *)doc, 0, 1);		printf("%s", (const char *)bufferPtr->content);    		strcpy(text, (const char *)bufferPtr->content);		xmlBufferFree(bufferPtr);      xmlFreeDoc(doc);	xmlCleanupParser();	return text;}
开发者ID:AlexandraPV,项目名称:Repository,代码行数:35,


示例2: xmlNewDoc

char *teacher_to_message(teacher_t *self, int id){    if(!self)        return NULL;    char buff[MSG_LENGTH];    xmlDoc * doc = NULL;	xmlNode * rootNode = NULL;	xmlNode * teacherNode = NULL;	xmlNode * cathedraNode = NULL;    doc = xmlNewDoc("1.0");	rootNode = xmlNewNode(NULL, "teachers");	xmlDocSetRootElement(doc, rootNode);	char strBuf[100];	teacherNode = xmlNewChild(rootNode, NULL, "teacher", NULL);	sprintf(strBuf, "%i", id);	xmlNewChild(teacherNode, NULL, "id", strBuf);	xmlNewChild(teacherNode, NULL, "firstName", self->name);	xmlNewChild(teacherNode, NULL, "lastName", self->surname);	xmlNewChild(teacherNode, NULL, "pensionDate", self->date);	sprintf(strBuf, "%i", self->hours);	xmlNewChild(teacherNode, NULL, "hours", strBuf);	sprintf(strBuf, "%f", self->rating);	xmlNewChild(teacherNode, NULL, "rating", strBuf);	cathedraNode = xmlNewChild(teacherNode, NULL, "cathedra", NULL);	xmlNewProp(cathedraNode, "name", self->cathedra->name);	xmlNewChild(cathedraNode, NULL, "speciality", self->cathedra->speciality);	xmlNewChild(cathedraNode, NULL, "group", self->cathedra->groups[0]);	xmlNewChild(cathedraNode, NULL, "group", self->cathedra->groups[1]);	xmlBuffer * bufferPtr = xmlBufferCreate();	xmlNodeDump(bufferPtr, NULL, (xmlNode *)doc, 0, 1);	sprintf(buff, "%s", (const char*)bufferPtr->content);    xmlFreeDoc(doc);	xmlCleanupParser();	xmlBufferFree(bufferPtr);    return buff;}
开发者ID:GlebDavydov,项目名称:Davydov-KP-52,代码行数:35,


示例3: fprintf

boolXml::saveToBuffer(XmlNode *curNode, std::string *buf) const{    if (NULL == curNode) {        fprintf(stderr, "[ERROR] In Xml::saveToBuffer, curNode == NULL/n");        return false;    }    if (NULL == buf) {        fprintf(stderr, "[ERROR] In Xml::saveToBuffer, buf == NULL/n");        return false;    }    xmlBuffer *xmlBuf = xmlBufferCreate();    if (NULL == xmlBuf) {        fprintf(stderr, "[ERROR] In Xml::saveToBuffer, "                "xmlBufferCreate() error/n");        return false;    }    int bytes = xmlNodeDump(xmlBuf, _doc, curNode,                            XML_INDENT_LEVEL, XML_FORMAT_ALLOWED);    if (bytes < 0) {        fprintf(stderr, "[ERROR] In Xml::saveToBuffer, xmlNodeDump() error/n");        return false;    }    *buf = (const char *)(xmlBuf->content);    xmlBufferFree(xmlBuf);    xmlBuf = NULL;    return true;}
开发者ID:sreadfox,项目名称:ossfs,代码行数:35,


示例4: xmlBufferCreate

void TrackerConfig::dump() const{    string s;    xmlBufferPtr pBuffer = xmlBufferCreate();    xmlNodeDump(pBuffer, m_Doc, m_pRoot, 0, 0);    cerr << xmlBufferContent(pBuffer) << endl;}
开发者ID:JohnChu,项目名称:libavg,代码行数:7,


示例5: as_string

string as_string(xmlNodePtr node) {    xmlBufferPtr buf = xmlBufferCreate();    xmlNodeDump(buf,node->doc,node,0,1);    string result((char*)buf->content);    xmlBufferFree(buf);    return result;}
开发者ID:treiche,项目名称:db_agg,代码行数:7,


示例6: info_to_xml

char * info_to_xml(char * name, char * group, char * var){	xmlDoc * doc = NULL;	xmlNode * rootNode = NULL;	doc = xmlNewDoc("1.0");	rootNode = xmlNewNode(NULL, "persons");	//FILE * file = fopen("newBase.xml", "w");	char * text = malloc(sizeof(char) * 1000);	for (int i = 0; i < 1000; i++)	{		text[i] = '/0';	}	xmlDocSetRootElement(doc, rootNode);	xmlNewChild(rootNode, NULL, "student", name);	xmlNewChild(rootNode, NULL, "group", group);	xmlNewChild(rootNode, NULL, "variant", var);	xmlBuffer * bufferPtr = xmlBufferCreate();	xmlNodeDump(bufferPtr, NULL, (xmlNode *)doc, 0, 1);	strcat(text, bufferPtr->content);	xmlBufferFree(bufferPtr);	xmlFreeDoc(doc);	xmlCleanupParser();	puts(text);	return text;}
开发者ID:bbehrang,项目名称:CoursesRepo,代码行数:25,


示例7: srd_printElementSet

intsrd_printElementSet (xmlDocPtr doc, xmlNodeSet *nodeSet, char **printBuffPtr, int printBuffSize){    xmlNode *cur_node = NULL;    int n, i;    xmlChar *value;    int offset = 0;    xmlBuffer *buff;    int size = printBuffSize;    char *newSpace;    for (i=0; i < nodeSet->nodeNr; i++) {    	cur_node = nodeSet->nodeTab[i];        if (cur_node->type == XML_ELEMENT_NODE) {           buff = xmlBufferCreate ();           xmlNodeDump (buff, doc,cur_node, 0, 1 );           if (size < (offset + strlen((char *)buff->content) + 1)){        	   size = offset + strlen((char *)buff->content) + 1;        	   newSpace = (char *)realloc (*printBuffPtr, size);        	   if (newSpace){        		   *printBuffPtr = newSpace;        	   } else {        		   // unable to allocate space        		   xmlBufferFree (buff);        		   return -1;        	   }           }           n = sprintf (*printBuffPtr+offset, "%s", buff->content);           offset = offset + n;           xmlBufferFree (buff);        }    }    return (offset);}
开发者ID:abnicken,项目名称:sysrepod,代码行数:35,


示例8: xmlBufferCreate

char *generate_xml(NFE *nfe, EVP_PKEY *key, X509 *cert) {	int rc;	xmlTextWriterPtr writer;	xmlDocPtr doc;	xmlBufferPtr buf = xmlBufferCreate();	writer = xmlNewTextWriterDoc(&doc, 0);	if (writer == NULL)		return NULL;	xmlTextWriterStartDocument(writer, NULL, "UTF-8", NULL);	rc = gen_inf_nfe(writer, nfe);	if (rc < 0)		return NULL;	xmlTextWriterEndDocument(writer);	char *URI = malloc(sizeof(char) * (strlen(nfe->idnfe->chave) +		strlen(ID_PREFIX) + 2));	strcpy(URI, "#");	strcat(URI, ID_PREFIX);	strcat(URI, nfe->idnfe->chave);	rc = sign_xml(doc, key, cert, URI);	if(rc)		return NULL;	xmlNodeDump(buf, NULL, xmlDocGetRootElement(doc), 0, 0);	nfe->xml = strdup((char*)buf->content);	return (char*)buf->content;}
开发者ID:pablogallardo,项目名称:livrenfe,代码行数:26,


示例9: search

VALUE search(VALUE self, VALUE xpathExpr){  VALUE results = rb_ary_new();  xmlDocPtr doc;  xmlXPathObjectPtr xpathObj;  xmlNodeSetPtr nodes;  xmlNodePtr cur;  xmlBufferPtr nodeBuffer;  int size, i;  Data_Get_Struct(self, xmlDoc, doc);  xpathObj = eval_and_search(doc, StringValueCStr(xpathExpr));  if (xpathObj == NULL) { return Qnil; }  nodes = xpathObj->nodesetval;  size = (nodes) ? nodes->nodeNr : 0;  for (i = 0; i < size; ++i) {    nodeBuffer = xmlBufferCreate();    xmlNodeDump(nodeBuffer, doc, nodes->nodeTab[i], 0, 1);    rb_ary_push(results, rb_str_new2(nodeBuffer->content));    xmlBufferFree(nodeBuffer);  }  xmlXPathFreeObject(xpathObj);  return results;}
开发者ID:abedra,项目名称:xpather,代码行数:30,


示例10: xmlBufferCreate

const std::string XMLElement::dump(bool indent) const{    xmlBufferPtr buffer = xmlBufferCreate();    xmlNodeDump(buffer, doc.getRealDocument(), node, 0, indent ? 1 : 0);    std::string str = std::string((const char *)buffer->content);    xmlBufferFree(buffer);    return str;}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:9,


示例11: get_xpath_xml

//!//! Places raw XML result of an xpath query into buf. The query must return//! only one element.//!//! @param[in] xml_path a string containing the path to the XML file to parse//! @param[in] xpath a string contianing the XPATH expression to evaluate//! @param[out] buf for the XML string//! @param[in] buf_len size of the buf//!//! @return EUCA_OK or EUCA_ERROR//!int get_xpath_xml(const char *xml_path, const char *xpath, char *buf, int buf_len){    int ret = EUCA_ERROR;    xmlDocPtr doc = NULL;    xmlXPathContextPtr context = NULL;    xmlXPathObjectPtr result = NULL;    xmlNodeSetPtr nodeset = NULL;    INIT();    pthread_mutex_lock(&xml_mutex);    {        if ((doc = xmlParseFile(xml_path)) != NULL) {            if ((context = xmlXPathNewContext(doc)) != NULL) {                if ((result = xmlXPathEvalExpression(((const xmlChar *)xpath), context)) != NULL) {                    if (!xmlXPathNodeSetIsEmpty(result->nodesetval)) {                        nodeset = result->nodesetval;                        if (nodeset->nodeNr > 1) {                            fprintf(stderr, "multiple matches for '%s' in '%s'/n", xpath, xml_path);                        } else {                            xmlNodePtr node = nodeset->nodeTab[0]->xmlChildrenNode;                            xmlBufferPtr xbuf = xmlBufferCreate();                            if (xbuf) {                                int len = xmlNodeDump(xbuf, doc, node, 0, 1);                                if (len < 0) {                                    fprintf(stderr, "failed to extract XML from %s/n", xpath);                                } else if (len > buf_len) {                                    fprintf(stderr, "insufficient buffer for %s/n", xpath);                                } else {                                    char *str = (char *)xmlBufferContent(xbuf);                                    euca_strncpy(buf, str, buf_len);                                    ret = EUCA_OK;                                }                                xmlBufferFree(xbuf);                            } else {                                fprintf(stderr, "failed to allocate XML buffer/n");                            }                        }                    }                    xmlXPathFreeObject(result);                } else {                    fprintf(stderr, "no results for '%s' in '%s'/n", xpath, xml_path);                }                xmlXPathFreeContext(context);            } else {                fprintf(stderr, "failed to set xpath '%s' context for '%s'/n", xpath, xml_path);            }            xmlFreeDoc(doc);        } else {            fprintf(stderr, "failed to parse XML in '%s'/n", xml_path);        }    }    pthread_mutex_unlock(&xml_mutex);    return ret;}
开发者ID:euca-nightfury,项目名称:eucalyptus,代码行数:67,


示例12: xmlKeepBlanksDefault

std::string XMLConfObj::toString(){    xmlIndentTreeOutput = 1;    xmlKeepBlanksDefault(0);    xmlBufferPtr xmlBufPtr = xmlBufferCreate();    xmlNodeDump(xmlBufPtr, documentTree, currentLevel, 0, 1);    std::string ret = std::string((char *)xmlBufPtr->content, xmlBufPtr->use);    xmlBufferFree(xmlBufPtr);    return ret;}
开发者ID:BackupTheBerlios,项目名称:vermont-svn,代码行数:10,


示例13: epp_getSubtree

char *epp_getSubtree(void *pool,		epp_command_data *cdata,		const char *xpath_expr,		int position){	char	*subtree;	xmlBufferPtr	 buf;	xmlDocPtr	 doc;	xmlNodePtr	 node;	xmlXPathObjectPtr	 xpath_obj;	xmlXPathContextPtr	 xpath_ctx;	doc = (xmlDocPtr) cdata->parsed_doc;	xpath_ctx = (xmlXPathContextPtr) cdata->xpath_ctx;	xpath_obj = xmlXPathEvalExpression(BAD_CAST xpath_expr, xpath_ctx);	if (xpath_obj == NULL)		return NULL;	/* correct position for non-list elements */	if (position == 0) position++;	if (xmlXPathNodeSetGetLength(xpath_obj->nodesetval) < position) {		xmlXPathFreeObject(xpath_obj);		/* return empty string if the node is not there */		return epp_strdup(pool, "");	}	/*	 * Get content of problematic tag. It's not so easy task. We have	 * to declare namespaces defined higher in the tree which are relevant	 * to the part of document being dumped. Fortunatelly there is a	 * function from libxml library doing exactly that (xmlreconsiliatens).	 */	buf = xmlBufferCreate();	if (buf == NULL)		return NULL;	node = xmlXPathNodeSetItem(xpath_obj->nodesetval, position - 1);	if (node->ns != NULL) {		xmlNsPtr	 nsdef;		nsdef = xmlSearchNs(doc, node, node->ns->prefix);		if (nsdef != NULL)			xmlNewNs(node, nsdef->href, nsdef->prefix);	}	if (xmlNodeDump(buf, doc, node, 0, 0) < 0)	{		xmlXPathFreeObject(xpath_obj);		xmlBufferFree(buf);		return NULL;	}	subtree = epp_strdup(pool, (char *) buf->content);	xmlXPathFreeObject(xpath_obj);	xmlBufferFree(buf);	return subtree;}
开发者ID:LANJr4D,项目名称:FRED,代码行数:55,


示例14: htmlReadMemory

万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。