若該文為原創文章,轉載請注明原文出處
本文章博客地址:https://blog.csdn.net/qq21497936/article/details/111828450
長期持續帶來更多專案與技術分享,咨詢請加QQ:21497936、微信:yangsir198808
紅胖子(紅模仿)的博文大全:開發技術集合(包含Qt實用技術、樹莓派、三維、OpenCV、OpenGL、ffmpeg、OSG、單片機、軟硬結合等等)持續更新中…(點擊傳送門)
Qt開發專欄:三方庫開發技術
前言
??Qt開發Xml相關技術,使用到tinyxml2庫,
TinyXML
??TinyXML是一個簡單的、小的C++的XML決議器,可以集成到其他程式中,它是ROS的標準XML決議器,
??最新的已經是TinyXML2版本了,
??github下載地址:https://github.com/leethomason/tinyxml2
??CSDN下載地址:https://download.csdn.net/download/qq21497936/13944558
??QQ群:1047134658(點擊“檔案”搜索“tinyxml2”,群內與博文同步更新)
TinyXML編譯
步驟一:解壓

步驟二:Cmake配置


??直接強上,先修改C編譯器的

??然后修改CXX編譯器的


步驟三:生成工程

步驟四:命令列編譯

步驟五:安裝install

模塊化

Demo
void TinyXmlManager::testEnv()
{
// 測驗創建一個簡單html檔案
tinyxml2::XMLDocument doc;
// 添加第一行
doc.Parse("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
// 添加第一個節點
// 添加第一個節點中的屬性 <ofd:OFD xmlns:ofd="http://www.ofdspec.org" DocType="OFD" Version="1.0">
tinyxml2::XMLElement * pXmlElement;
pXmlElement = doc.NewElement("ofd:OFD");
pXmlElement->SetAttribute("xmlns:ofd", "http://www.ofdspec.org");
pXmlElement->SetAttribute("DocType", "OFD");
pXmlElement->SetAttribute("Version", "1.0");
// 子節點 <ofd:DocBody>
tinyxml2::XMLElement * pXmlElement2;
pXmlElement2 = doc.NewElement("ofd:DocBody");
pXmlElement2->SetAttribute("Author", "紅模仿");
pXmlElement2->SetAttribute("QQ", 21497936);
pXmlElement2->SetAttribute("Blog", "https://blog.csdn.net/qq21497936");
pXmlElement->InsertEndChild(pXmlElement2);
doc.InsertEndChild(pXmlElement);
// 保存
doc.SaveFile("1.xml");
}
測驗結果

工程模板v1.0.0
??對應工程模板:tinyXmlDemo_v1.0.0_基礎工程_運行環境測驗.rar
若該文為原創文章,轉載請注明原文出處
本文章博客地址:https://blog.csdn.net/qq21497936/article/details/111828450
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/241912.html
標籤:其他
上一篇:STM匯編程式設計
