本文整理汇总了C++中pugi::xml_document::append_child方法的典型用法代码示例。如果您正苦于以下问题:C++ xml_document::append_child方法的具体用法?C++ xml_document::append_child怎么用?C++ xml_document::append_child使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pugi::xml_document
的用法示例。
在下文中一共展示了xml_document::append_child方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeHeader
pugi::xml_node SvgPrinter::writeHeader(pugi::xml_document &doc)
{
pugi::xml_node rootNode = doc.append_child("svg");
rootNode.append_attribute("xmlns") = "http://www.w3.org/2000/svg";
rootNode.append_attribute("xmlns:xlink") = "http://www.w3.org/1999/xlink";
rootNode.append_attribute("xmlns:ev") = "http://www.w3.org/2001/xml-events";
rootNode.append_attribute("version") = "1.1";
rootNode.append_attribute("baseProfile") = "full";
if(!m_settings.width().empty()) {
rootNode.append_attribute("width") = m_settings.width().c_str();
}
if(!m_settings.height().empty()) {
rootNode.append_attribute("height") = m_settings.height().c_str();
}
DRect box = m_clsAttr ? m_clsAttr->boundingBox() : m_attr.boundingBox();
double margin = m_settings.margin();
std::stringstream is;
is << (box.p1().m_x - margin);
is << " " << (box.p1().m_y - margin);
is << " " << (box.width() + 2*margin);
is << " " << (box.height() + 2*margin);
rootNode.append_attribute("viewBox") = is.str().c_str();
pugi::xml_node style_node = rootNode.append_child("style");
style_node.text() = (".font_style {font: " + std::to_string(m_settings.fontSize()) + "px monospace;}").c_str();
return rootNode;
}
示例2:
//-----------------------------------------------------------------------------
void X3DFile::output_xml_header(pugi::xml_document& xml_doc,
const std::vector<double>& xpos)
{
if (MPI::process_number() == 0)
{
xml_doc.append_child(pugi::node_doctype).set_value("X3D PUBLIC \"ISO//Web3D//DTD X3D 3.2//EN\" \"http://www.web3d.org/specifications/x3d-3.2.dtd\"");
pugi::xml_node x3d = xml_doc.append_child("X3D");
x3d.append_attribute("profile") = "Interchange";
x3d.append_attribute("version") = "3.2";
x3d.append_attribute("xmlns:xsd")
= "http://www.w3.org/2001/XMLSchema-instance";
x3d.append_attribute("xsd:noNamespaceSchemaLocation")
= "http://www.web3d.org/specifications/x3d-3.2.xsd";
pugi::xml_node scene = x3d.append_child("Scene");
pugi::xml_node viewpoint = scene.append_child("Viewpoint");
std::string xyz = boost::lexical_cast<std::string>(xpos[0]) + " "
+ boost::lexical_cast<std::string>(xpos[1]) + " "
+ boost::lexical_cast<std::string>(xpos[3]);
viewpoint.append_attribute("position") = xyz.c_str();
viewpoint.append_attribute("orientation") = "0 0 0 1";
viewpoint.append_attribute("fieldOfView") = "0.785398";
xyz = boost::lexical_cast<std::string>(xpos[0]) + " "
+ boost::lexical_cast<std::string>(xpos[1]) + " "
+ boost::lexical_cast<std::string>(xpos[2]);
viewpoint.append_attribute("centerOfRotation") = xyz.c_str();
viewpoint.append_attribute("zNear") = "-1";
viewpoint.append_attribute("zFar") = "-1";
pugi::xml_node background = scene.append_child("Background");
background.append_attribute("skyColor") = "0.9 0.9 1.0";
pugi::xml_node shape = scene.append_child("Shape");
pugi::xml_node material
= shape.append_child("Appearance").append_child("Material");
material.append_attribute("ambientIntensity") = "0.05";
material.append_attribute("shininess") = "0.5";
material.append_attribute("diffuseColor") = "0.7 0.7 0.7";
material.append_attribute("specularColor") = "0.9 0.9 0.9";
material.append_attribute("emmisiveColor") = "0.7 0.7 0.7";
shape.append_child(facet_type.c_str()).append_attribute("solid") = "false";
}
}
示例3: saveMap
void saveMap(pugi::xml_document& doc, std::map<K, V>& map, const char* type)
{
for(auto iter = map.begin(); iter != map.end(); iter++)
{
pugi::xml_node node = doc.append_child(type);
node.append_attribute("name").set_value(iter->first.c_str());
node.append_attribute("value").set_value(iter->second);
}
}
示例4: create_confirm_xml
void Device::create_confirm_xml(pugi::xml_document &doc, int n_readings)
{
doc.reset();
// client base node
pugi::xml_node node = doc.append_child("server");
xml_header(doc);
xml_latest_readings(doc, true, n_readings);
}
示例5: create_readings_xml
void Device::create_readings_xml(pugi::xml_document &doc, int n_readings)
{
doc.reset();
// client base node
pugi::xml_node node = doc.append_child("client");
xml_header(doc);
xml_readings(doc, false, n_readings);
}
示例6: serialization
void FontExportSerializer::serialization(pugi::xml_document& _doc)
{
pugi::xml_node root = _doc.append_child("MyGUI");
root.append_attribute("type").set_value("Resource");
root.append_attribute("version").set_value("1.1");
DataPtr data = DataManager::getInstance().getRoot();
for (Data::VectorData::const_iterator child = data->getChilds().begin(); child != data->getChilds().end(); child ++)
writeFont(root, (*child));
}
示例7: saveMap
void saveMap(pugi::xml_document &doc, std::map<K, V> &map, const char *type) {
for (auto iter = map.begin(); iter != map.end(); iter++) {
// key is on the "don't save" list, so don't save it
if (std::find(settings_dont_save.begin(), settings_dont_save.end(), iter->first) != settings_dont_save.end())
continue;
pugi::xml_node node = doc.append_child(type);
node.append_attribute("name").set_value(iter->first.c_str());
node.append_attribute("value").set_value(iter->second);
}
}
示例8: create_root
NodePtr Document::create_root(const char* name) {
pugi::xml_node n = m_doc.append_child(name);
return NodePtr(new Node(DocumentConstPtr(this),n));
}