本文整理汇总了C++中xml::Node::AddEmptyChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::AddEmptyChild方法的具体用法?C++ Node::AddEmptyChild怎么用?C++ Node::AddEmptyChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xml::Node
的用法示例。
在下文中一共展示了Node::AddEmptyChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: XmlTree
void XmlTree (std::ostream & out)
{
XML::Tree tree;
XML::Node * root = tree.SetRoot ("UnitTest");
std::auto_ptr<XML::Node> child1 (new XML::Node ("child"));
child1->AddAttribute ("num", "1");
child1->AddTransformAttribute ("level", "1");
child1->AddTransformAttribute ("upperExamples",
"some upper chars: А, ▓, ├ or нт and finally Ш.");
child1->AddTransformText ("This text contains all 5 special characters:\n"
"ampersand: &, quotation mark: \", apostrophe: ', less than: < "
"and greater than char: >.");
root->AddChild (child1);
root->AddText ("This is my next child");
XML::Node * node = root->AddChild ("child");
node->AddAttribute ("num", 2);
node->AddAttribute ("level", 1);
XML::Node * grandChild = node->AddEmptyChild ("Grandchild");
grandChild->AddAttribute ("age", 2);
tree.Write (out);
XML::Node const * firstChild = *tree.GetRoot ()->FirstChild ();
out << "\n\nTransform back upper-ascii characters: "
<< firstChild->GetTransformAttribValue ("upperExamples") << std::endl;
out << "\nTransform back the text: "
<< (*firstChild->FirstChild ())->GetTransformAttribValue ("Text") << std::endl;
}