기본 콘텐츠로 건너뛰기

라벨이 rapidxml인 게시물 표시

[XML]Quick notes on how to use RapidXML

There’s a C++ XML library called RapidXML which is perfect for most non-enterprise uses of XML. I wouldn’t call this a tutorial, but I hope this ends up helping someone. The documentation isn’t very explicit on how to output an XML declaration, for example. How to create your XML from scratch and then output this XML into a string, with an XML declaration: [code xml]<?xml version="1.0" encoding="utf-8"?> <rootnode version="1.0" type="example">   <childnode/> </rootnode>[/code][code cpp]using namespace rapidxml;   xml_document<> doc;   // xml declaration xml_node<>* decl = doc.allocate_node(node_declaration); decl->append_attribute(doc.allocate_attribute("version", "1.0")); decl->append_attribute(doc.allocate_attribute("encoding", "utf-8")); doc.append_node(decl);   // root node xml_node<>* root = doc.allocate_node(node_element, "rootnode"); root-...