本文整理汇总了C++中XmlDocument::allocate_attribute方法的典型用法代码示例。如果您正苦于以下问题:C++ XmlDocument::allocate_attribute方法的具体用法?C++ XmlDocument::allocate_attribute怎么用?C++ XmlDocument::allocate_attribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlDocument
的用法示例。
在下文中一共展示了XmlDocument::allocate_attribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddResNode
//using namespace rapidxml;
EngineInfo::EngineInfo()
{
XmlDocument doc;
XmlNode* decl = doc.allocate_node(rapidxml::node_declaration);
decl->append_attribute(doc.allocate_attribute(L"version", L"1.0"));
decl->append_attribute(doc.allocate_attribute(L"encoding", L"utf-8"));
decl->append_attribute(doc.allocate_attribute(L"standalone", L"yes"));
doc.append_node(decl);
XmlNode* root = doc.allocate_node(rapidxml::node_element, L"EngineInfo");
root->append_attribute(doc.allocate_attribute(L"version", L"1.0"));
doc.append_node(root);
XmlNode* resNodes = doc.allocate_node(rapidxml::node_element,L"SupportedResources");
root->append_node(resNodes);
// add supported 3d models.
const wchar_t* modeltype = ResourceType::ToWString(ResourceType::Model);
AddResNode(doc,resNodes,modeltype,L"Model",L"3d model",L".atgi,.dae");
// add supported textures
const wchar_t* textureType = ResourceType::ToWString(ResourceType::Texture);
AddResNode(doc,resNodes,textureType,L"Texture",L"Texture file",L".dds,.bmp,.jpg,.png,.tga,.tif");
// Add any other engine information
// print to string.
rapidxml::print(back_inserter(m_data), doc, 0);
}