本文整理汇总了C++中xml_document::append_node方法的典型用法代码示例。如果您正苦于以下问题:C++ xml_document::append_node方法的具体用法?C++ xml_document::append_node怎么用?C++ xml_document::append_node使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xml_document
的用法示例。
在下文中一共展示了xml_document::append_node方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeCreateSchemeXml
/**
* @brief WrapperXml::writeXml, metodo para escribir un xml
* @param pRuta, directorio en el que se guardara el documento
* @param pRoot, raiz del documento
* @param pSon, hijo del documento
*/
void WrapperXml::writeCreateSchemeXml(std::string pMsg, xml_document<> &pDocument){
xml_node<>* decl = pDocument.allocate_node(node_declaration);
decl->append_attribute(pDocument.allocate_attribute(VERSION, NUMVERSION));
decl->append_attribute(pDocument.allocate_attribute(ENCODE, TYPEENCODE));
pDocument.append_node(decl);
xml_node<>* root = pDocument.allocate_node(node_element, SCHEME);
pDocument.append_node(root);
std::istringstream pBuffer(pMsg);
std::string subString;
pBuffer >> subString;
xml_node<>* childSN = pDocument.allocate_node(node_element, SCHEMENAME);
childSN->value(strdup(subString.c_str()));
root->append_node(childSN);
pBuffer >> subString;
xml_node<>* childR = pDocument.allocate_node(node_element, RAID);
childR->value(strdup(subString.c_str()));
root->append_node(childR);
while(pBuffer){
pBuffer >> subString;
if(subString==HASH)
break;
else{
xml_node<>* childD = pDocument.allocate_node(node_element, DATA);
xml_node<>* childDT = pDocument.allocate_node(node_element, DATATYPE);
childDT->value(strdup(subString.c_str()));
childD->append_node(childDT);
pBuffer >> subString;
xml_node<>* childDL = pDocument.allocate_node(node_element, DATANAME );
childDL->value(strdup(subString.c_str()));
childD->append_node(childDL);
pBuffer >> subString;
xml_node<>* childDN= pDocument.allocate_node(node_element, DATANAME);
childDN->value(strdup(subString.c_str()));
childD->append_node(childDN);
root->append_node(childD);
}
}
}