TinyXml Documentation 翻译 TinyXML Tutorial翻译

前端之家收集整理的这篇文章主要介绍了TinyXml Documentation 翻译 TinyXML Tutorial翻译前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

最近在做毕业论文,可能要使用TinyXML。全是英文看着费劲。所以翻译了一下! 所有翻译后的文件直接被放到网盘中了。如果您需要的话自己去找吧 !网盘地址见我的主页。

网盘中有一个名字叫做《TinyXML文档集合》的word文件


(1)http://www.grinninglizard.com/tinyxmldocs/index.html 翻译了这个页面上的所有东西

(2)http://www.grinninglizard.com/tinyxmldocs/tutorial0.html翻译了这个页面上的所有东西


TinyXML 基本操作如下,经过VS2013调试,全部能够运行!

  1. #include "iostream"
  2. #include "vector"
  3. #include "string"
  4. #include "list"
  5. #include "deque"
  6. #include "utility"
  7. #include "map"
  8. #include "set"
  9. #include "fstream"
  10. #include "sstream"
  11. #include "algorithm"
  12. #include "numeric"
  13. #include "iterator"
  14. #include "functional"
  15. #include "typeinfo.h"
  16. #include "memory"
  17. #include "exception"
  18. #include "assert.h"
  19. #include <bitset>
  20. #include "stdio.h"
  21. #include "stdlib.h"
  22. #include "malloc.h"
  23. #include <string.h>
  24.  
  25. using namespace std;
  26.  
  27. #include <stdio.h>
  28. #include <stdlib.h>
  29. #include "tinyxml.h"
  30. #include "tchar.h"
  31. using namespace std;
  32.  
  33. // <?xml version="1.0" ?>
  34. // <MyApp>
  35. // <Messages>
  36. // <Welcome>Welcome to MyApp</Welcome>
  37. // <Farewell>Thank you for using MyApp</Farewell>
  38. // </Messages>
  39. // <Windows>
  40. // <Window name="MainFrame" x="5" y="15" w="400" h="250" />
  41. // </Windows>
  42. // <Connection ip="192.168.0.1" timeout="123.456000" />
  43. // </MyApp>
  44. //创建了一个D:\\yang.xml的文件
  45.  
  46. //通过指定名字创建一个XML文件。参数是文件的名字。
  47. bool CreateXMLFile(char * FileName)
  48. {
  49. TiXmlDocument * pDoc = new TiXmlDocument;//创建一个文档类型对象,整个XML文档的最上层节点
  50. if (NULL==pDoc)
  51. {
  52. return false;
  53. }
  54. //构造函数
  55. // TiXmlDeclaration(const char* _version,// const char* _encoding,// const char* _standalone); standalone脱机,单独,独立
  56.  
  57. //创造一个声明的类。<?xml version="1.0" ?>
  58. TiXmlDeclaration * pDeclaration = new TiXmlDeclaration(("1.0"),(""),(""));
  59. if (NULL==pDeclaration)
  60. {
  61. return false;
  62. }
  63.  
  64. pDoc->LinkEndChild(pDeclaration);//把pDeclaration做为pDoc的一个孩子节点。
  65. //生成一个根节点:MyApp
  66. TiXmlElement * pRootEle = new TiXmlElement(("MyApp"));
  67. if (NULL==pRootEle)
  68. {
  69. return false;
  70. }
  71. pDoc->LinkEndChild(pRootEle);
  72. //生成子节点:Messages
  73. TiXmlElement * pMsg = new TiXmlElement(("Messages"));
  74. if (NULL==pMsg)
  75. {
  76. return false;
  77. }
  78.  
  79. pRootEle->LinkEndChild(pMsg);
  80.  
  81. //生成子节点welcome
  82. TiXmlElement * pWelcome = new TiXmlElement(("Welcome"));
  83. if (NULL==pWelcome)
  84. {
  85. return false;
  86. }
  87.  
  88. pMsg->LinkEndChild(pWelcome);
  89.  
  90. //设置Welcome节点的值
  91. const char * strValue = ("Welcome to MyApp");
  92. TiXmlText * pWelcomeValue = new TiXmlText(strValue);
  93. pWelcome->LinkEndChild(pWelcomeValue);
  94.  
  95. //生成子节点:Farewell
  96. TiXmlElement * pFarewell = new TiXmlElement(("Farewell"));
  97. if (NULL==pFarewell)
  98. {
  99. return false;
  100. }
  101.  
  102. pMsg->LinkEndChild(pFarewell);
  103. //设置Farewell节点的值
  104. strValue = ("Thank you for using MyApp");
  105. TiXmlText * pFarewellValue = new TiXmlText(strValue);
  106. pFarewell->LinkEndChild(pFarewellValue);
  107. //生成子节点:Windows
  108. TiXmlElement * pWindows = new TiXmlElement(("Windows"));
  109. if (NULL==pWindows)
  110. {
  111. return false;
  112. }
  113. pRootEle->LinkEndChild(pWindows);
  114. //生成子节点:Window
  115. TiXmlElement * pWindow = new TiXmlElement(("Window"));
  116. if (NULL==pWindow)
  117. {
  118. return false;
  119. }
  120. pWindows->LinkEndChild(pWindow);
  121. //设置节点Window的值
  122. pWindow->SetAttribute(("name"),("MainFrame"));
  123. pWindow->SetAttribute(("x"),("5"));
  124. pWindow->SetAttribute(("y"),("15"));
  125. pWindow->SetAttribute(("w"),("400"));
  126. pWindow->SetAttribute(("h"),("250"));
  127. //生成子节点connection
  128. TiXmlElement * pConnect = new TiXmlElement(("Connection"));
  129. if (NULL==pConnect)
  130. {
  131. return false;
  132. }
  133.  
  134. pRootEle->LinkEndChild(pConnect);
  135. //设置节点connection的值
  136. pConnect->SetAttribute(("ip"),("192.168.0.1"));
  137. pConnect->SetAttribute(("timeout"),("123.456000"));
  138. pDoc->SaveFile(FileName);
  139. }
  140.  
  141. //打印整个XML文件中的所有行
  142. bool PintXML(const char * FileName)
  143. {
  144. TiXmlDocument * pDocument = new TiXmlDocument;
  145. if (NULL==pDocument)
  146. {
  147. return false;
  148. }
  149. pDocument->LoadFile(FileName);
  150. pDocument->Print();
  151. }
  152.  
  153. //获取指向指定名字节点的指针
  154. //三个参数的意思:第一个参数表示一个XML文档中树根节点,strNodeName表示你要查找的节点的名字,第三个参数返回指向找到节点的指针
  155. bool GetNodePointerByName(TiXmlElement * pRootEle,string & strNodeName,TiXmlElement * & Node)
  156. {
  157. //假如等于根节点名字,就退出
  158. if (strNodeName==pRootEle->Value())
  159. {
  160. Node = pRootEle;
  161. return true;
  162. }
  163. TiXmlElement * pEle = pRootEle;
  164. for (pEle = pRootEle->FirstChildElement(); pEle;pEle=pEle->NextSiblingElement())
  165. {
  166. //递归处理子节点,获取节点指针
  167. if (GetNodePointerByName(pEle,strNodeName,Node))
  168. {
  169. return true;
  170. }
  171. }
  172. return false;
  173. }
  174.  
  175. //通过名字查询一个节点中的文本内容
  176. //第一个参数是XML文件名字,第二个参数是节点的名字,第三个参数是返回的节点的内容
  177. bool QueryNode_Text(string XmlFile,string strNodeName,string & strText)
  178. {
  179. //定义一个
  180. TiXmlDocument * pDoc = new TiXmlDocument;
  181. if (NULL==pDoc)
  182. {
  183. return false;
  184. }
  185. pDoc->LoadFile(XmlFile.c_str());
  186.  
  187. TiXmlElement * pRootEle = pDoc->RootElement();
  188. if (NULL==pRootEle)
  189. {
  190. return false;
  191. }
  192. TiXmlElement * pNode = NULL;
  193. GetNodePointerByName(pRootEle,pNode);
  194. if (NULL!=pNode)
  195. {
  196. if (NULL!=pNode->GetText())
  197. {
  198. strText=pNode->GetText();
  199. return true;
  200. }
  201. else
  202. {
  203. cout << "这个节点没有text内容" << endl;
  204. return false;
  205. }
  206. //strText=pNode->GetText();
  207. //注意上面的这条语句,如果这个节点中是没有任何text内容的话,那么就会产生运行时候错误
  208. //所以如果不想产生运行时错误,那么就要进行一个判断是否为空串。
  209. }
  210. else
  211. {
  212. return false;
  213. }
  214. }
  215.  
  216. //查询节点属性输入文件名字,节点名字,和一个map。其中最后一个参数map用来保存,若干属性的值。
  217. bool QueryNode_Attribute(string XmlFile,map<string,string> & AttMap)
  218. {
  219. typedef pair<string,string> String_Pair;
  220. TiXmlDocument * pDoc = new TiXmlDocument;//定义一个文档类型
  221. if (NULL==pDoc)
  222. {
  223. return false;
  224. }
  225. pDoc->LoadFile(XmlFile.c_str());
  226. TiXmlElement * pRootEle = pDoc->RootElement();//获取文档的根
  227. if (NULL==pRootEle)
  228. {
  229. return false;
  230. }
  231. TiXmlElement * pNode = NULL;
  232. GetNodePointerByName(pRootEle,pNode);
  233. if (NULL!=pNode)
  234. {
  235. TiXmlAttribute * pAttr = NULL;//创建一个属性
  236. for (pAttr = pNode->FirstAttribute(); pAttr;pAttr=pAttr->Next())//获取【每一个】属性
  237. {
  238. string strAttName = pAttr->Name();//获取属性的-----键
  239. string strAttValue = pAttr->Value();//获取属性的-----值
  240. AttMap.insert(String_Pair(strAttName,strAttValue));
  241. //把属性的(键---值)对做成String_Pair,然后把String_Pair对插入到Map中,并通过第三个参数的引用返回。
  242. }
  243. }
  244. else
  245. {
  246. return false;
  247. }
  248. return true;
  249. }
  250.  
  251. //通过节点的名字,在XML文档中,删除指定的节点。注意删除一个节点,不仅仅删除了这个节点,而且会删除它的子孙。
  252. bool DelNode(string XmlFile,string strNodeName)
  253. {
  254. TiXmlDocument * pDoc = new TiXmlDocument;
  255. if (NULL == pDoc)
  256. {
  257. return false;
  258. }
  259. pDoc->LoadFile(XmlFile.c_str());
  260. TiXmlElement * pRootEle = pDoc->RootElement();
  261. if (NULL == pRootEle)
  262. {
  263. return false;
  264. }
  265. TiXmlElement * pNode = NULL;
  266. GetNodePointerByName(pRootEle,pNode);
  267.  
  268. if (pRootEle == pNode)
  269. {
  270. if (pDoc->RemoveChild(pRootEle))//如果查询的节点是根节点,那么就删除这个节点
  271. {
  272. pDoc->SaveFile(XmlFile.c_str());//删除这个节点之后保存这个新的XML文件
  273. return true;
  274. }
  275. else
  276. {
  277. return false;
  278. }
  279. }//endif
  280.  
  281. if (NULL != pNode)
  282. {
  283. TiXmlNode * pParNode = pNode->Parent();//找到要删除节点的父节点
  284. if (NULL == pParNode)
  285. {
  286. return false;
  287. }
  288. TiXmlElement * pParentEle = pParNode->ToElement();//把一个Node类型节点转换成为一个Element类型节点
  289. //也就是把一个TiXmlNode类型的节点通过ToElement()调用转换成为TiXmlElement类型节点。
  290. if (NULL != pParentEle)
  291. {
  292. if (pParentEle->RemoveChild(pNode))//调用父节点pParentEle的一个函数RemoveChild,然后删除自己的一个孩子节点pNode
  293. {
  294. pDoc->SaveFile(XmlFile.c_str());
  295. return true;
  296. }
  297. else
  298. {
  299. return false;
  300. }
  301. }
  302. }//endif
  303. else
  304. {
  305. return false;
  306. }
  307. }
  308.  
  309.  
  310. //修改节点Text内容的操作
  311. //第一个参数是文件名字,第二个参数是要修改的节点的名字,第三个是修改的新文本
  312. bool ModifyNode_Text(string XmlFile,string strText)
  313. {
  314. TiXmlDocument * pDoc = new TiXmlDocument;
  315. if (NULL==pDoc)
  316. {
  317. return false;
  318. }
  319. pDoc->LoadFile(XmlFile.c_str());
  320. TiXmlElement * pRootEle = pDoc->RootElement();
  321. if (NULL==pRootEle)
  322. {
  323. return false;
  324. }
  325. TiXmlElement * pNode = NULL;
  326. GetNodePointerByName(pRootEle,pNode);
  327. if (NULL!=pNode)
  328. {
  329. pNode->Clear();//首先清除pNode指针所指向的节点原来的所有文本。
  330. //然后插入文本保存文件
  331. TiXmlText * pValue = new TiXmlText(strText.c_str());
  332. pNode->LinkEndChild(pValue);//创建一个TiXmlText类型的节点,让这个节点作为pNode节点的最后一个孩子。
  333. pDoc->SaveFile(XmlFile.c_str());//修改之后保存整个XML文件
  334. return true;
  335. }
  336. else
  337. {
  338. return false;
  339. }
  340. }
  341.  
  342.  
  343. //通过指定的节点的名字,修改节点的属性
  344. //第一个参数XML文件的名字,第二个参数节点的名字,第三个参数要修改属性的值
  345. bool ModifyNode_Attribute(string XmlFile,string> & AttMap)
  346. {
  347. typedef pair<string,string> String_Pair;
  348.  
  349. TiXmlDocument * pDoc = new TiXmlDocument;
  350. if (NULL==pDoc)
  351. {
  352. return false;
  353. }
  354. pDoc->LoadFile(XmlFile.c_str());
  355. TiXmlElement * pRootEle = pDoc->RootElement();
  356. if (NULL==pRootEle)
  357. {
  358. return false;
  359. }
  360. TiXmlElement * pNode = NULL;
  361. GetNodePointerByName(pRootEle,pNode);
  362. if (NULL!=pNode)
  363. {
  364. TiXmlAttribute * pAttr = NULL;
  365. string strAttName = ("");//原来这里的代码上是这样的 _T("");但是这样的话编译的时候就会出现错误
  366. string strAttValue = ("");
  367. for (pAttr = pNode->FirstAttribute(); pAttr;pAttr=pAttr->Next())
  368. {
  369. strAttName = pAttr->Name();
  370. map<string,string>::iterator iter;
  371. for (iter = AttMap.begin(); iter != AttMap.end();iter++)
  372. {//遍历整个的属性map,如果找到和输入的属性名字相同的属性,那么就把指定的属性值设置成为输入属性的值。
  373. if (strAttName==iter->first)
  374. {
  375. pAttr->SetValue((iter->second).c_str());
  376. }
  377. }
  378. }
  379. pDoc->SaveFile(XmlFile.c_str());
  380. return true;
  381. }
  382. else
  383. {
  384. return false;
  385. }
  386. }
  387.  
  388. //在指定的节点下面增加一个孩子节点,并且这个新节点可以设置text内容
  389. //第一个参数是XML文档的文件名字,第二个参数是要插入的父节点的名字,第三个参数是新创建的节点的名字,第四个参数是新创建的节点的文本内容
  390. bool AddNode_Text(string XmlFile,string strParNodeName,strParNodeName,pNode);//首先找到父节点,因为将在这个节点下面插入新创建的子节点
  391. if (NULL!=pNode)
  392. {
  393. //生成子节点
  394. TiXmlElement * pNewNode = new TiXmlElement(strNodeName.c_str());
  395. if (NULL==pNewNode)
  396. {
  397. return false;
  398. }
  399. //设置节点文本,然后插入节点
  400. TiXmlText * pNewValue = new TiXmlText(strText.c_str());
  401. pNewNode->LinkEndChild(pNewValue);//TiXmlNode* LinkEndChild( TiXmlNode* addThis )
  402. pNode->InsertEndChild(*pNewNode);//TiXmlNode* InsertEndChild( const TiXmlNode& addThis ),这个函数的实现调用了InsertEndChild()
  403. pDoc->SaveFile(XmlFile.c_str());
  404. return true;
  405. }
  406. else
  407. {
  408. return false;
  409. }
  410.  
  411. }
  412.  
  413.  
  414. //在指定名字节点下面增加一个节点,并且设置这个节点的属性
  415. //第一个参数是要操作的XML文件的名字,第二个参数是父节点的名字,第三个参数是新插入的节点的名字,第四个参数是要设置的属性
  416. bool AddNode_Attribute(string XmlFile,string>&AttMap)
  417. {
  418. TiXmlDocument * pDoc = new TiXmlDocument;
  419. if (NULL == pDoc)
  420. {
  421. return false;
  422. }
  423. pDoc->LoadFile(XmlFile.c_str());
  424. TiXmlElement * pRootEle = pDoc->RootElement();
  425. if (NULL==pRootEle)
  426. {
  427. return false;
  428. }
  429. TiXmlElement * pNode = NULL;
  430. GetNodePointerByName(pRootEle,pNode);
  431. if (NULL!=pNode)
  432. {
  433. TiXmlElement * pNewNode = new TiXmlElement(strNodeName.c_str());
  434. if (NULL==pNewNode)
  435. {
  436. return false;
  437. }
  438. map<string,string>::iterator iter;
  439. for (iter = AttMap.begin(); iter != AttMap.end();iter++)
  440. {
  441. pNewNode->SetAttribute(iter->first.c_str(),iter->second.c_str());
  442. }
  443. pNode->InsertEndChild(*pNewNode);
  444. pDoc->SaveFile(XmlFile.c_str());
  445. return true;
  446. }
  447. else
  448. {
  449. return false;
  450. }
  451. }
  452.  
  453. //打印出整个的XML文档
  454. bool PintXML(string FileName)
  455. {
  456. TiXmlDocument *pDoc = new TiXmlDocument();
  457. if (NULL == pDoc)
  458. {
  459. return false;
  460. }
  461. pDoc->LoadFile(FileName.c_str());
  462. pDoc->Print();
  463. getchar();
  464. }
  465.  
  466.  
  467.  
  468.  
  469. int main(int argc,char * argv[])
  470. {
  471.  
  472. char * filename = "D:\\yang.xml";
  473.  
  474. {//块1
  475. //创建一个yang.xml文件
  476. bool result = CreateXMLFile(filename);
  477. if (!result)
  478. {
  479. cout << "出现了错误!" << endl;
  480. }
  481. else
  482. {
  483. cout << "XML文件创建成功" << endl << endl;
  484. }
  485.  
  486.  
  487. //打印整个的yang.xml文件
  488. {
  489. PintXML(filename);
  490. }
  491. }//块1结束
  492.  
  493.  
  494.  
  495. {//块2
  496. //在这个yang.xml文件中查找welcome节点,并获取一个指向这个节点的指针,然后输出这个节点的类型。
  497. TiXmlDocument * pDocument = new TiXmlDocument;
  498. if (NULL == pDocument)
  499. {
  500. return false;
  501. }
  502. pDocument->LoadFile(filename);
  503. TiXmlElement * pRoot = pDocument->RootElement();
  504. string strNodeName("Window");
  505. TiXmlElement * pToNode = NULL;
  506. GetNodePointerByName(pRoot,pToNode);
  507. if (pToNode)
  508. {
  509. cout << "\n========================" << endl;
  510. cout << pToNode->Type() << endl;//这里会打印类型1,因为这是一个TiXmlElement类型的对象。
  511. cout << "========================" << endl;
  512. }
  513. // enum NodeType
  514. // {
  515. // TINYXML_DOCUMENT,0
  516. // TINYXML_ELEMENT,1
  517. // TINYXML_COMMENT,2
  518. // TINYXML_UNKNOWN,3
  519. // TINYXML_TEXT,4
  520. // TINYXML_DECLARATION,5
  521. // TINYXML_TYPECOUNT 6
  522. // };
  523. }//块2结束
  524.  
  525.  
  526.  
  527. {//块3
  528. //查找指定名字的节点的内容,然后输出
  529. {
  530. //查询一个节点中的文本内容,[此处查找的Windows节点是没有text内容的,查找不成功]
  531. string strOutput;
  532. string FileName(filename);
  533. string strNodeName("Window");
  534. bool result = QueryNode_Text(FileName,strOutput);
  535. if (result)
  536. {
  537. cout << "\n========================" << endl;
  538. cout << strOutput << endl;
  539. cout << "========================" << endl;
  540. }
  541. }
  542.  
  543. {
  544. //查询一个节点中的文本内容,[此处查找的Welcome节点是有text内容的,查找成功]
  545. string strOutput;
  546. string FileName(filename);
  547. string strNodeName("Welcome");
  548. bool result = QueryNode_Text(FileName,strOutput);
  549. if (result)
  550. {
  551. cout << "\n========================" << endl;
  552. cout << strOutput << endl;
  553. cout << "========================" << endl;
  554. }
  555. }
  556.  
  557. }//块3结束
  558.  
  559.  
  560.  
  561. {//块4开始
  562. //通过节点名字查找节点的所有属性
  563. map<string,string> AttMap_inPut;
  564. map<string,string>::iterator iter;
  565. string FileName(filename);
  566. string strNodeName("Window");
  567. bool result = QueryNode_Attribute(FileName,AttMap_inPut);
  568. if (result)
  569. {
  570. for (iter = AttMap_inPut.begin(); iter != AttMap_inPut.end(); ++iter)
  571. {
  572. cout << iter->first << "\t" << iter->second << endl;
  573. }
  574. cout << "========================" << endl;
  575. }
  576. else
  577. {
  578. cout << "读取属性出现错误" << endl;
  579. }
  580.  
  581. }//块4结束
  582.  
  583. {//块5开始
  584. //通过节点的名字,在XML文档中,删除指定的节点。
  585. getchar();
  586. string FileName(filename);
  587. string strNodeName("Welcome");
  588. bool result = DelNode(FileName,strNodeName);
  589. if (false == result)
  590. {
  591. cout << "删除节点错误!\n" << endl;
  592. }
  593. else
  594. {
  595. cout << "删除节点成功!\n" << endl;
  596. }
  597.  
  598. }//块5结束
  599.  
  600. {//块6开始
  601. //修改指定名字节点的text值。
  602. getchar();
  603. string FileName(filename);
  604. string strNodeName("Farewell");
  605. string strText("This is the lastest text");
  606. bool result = ModifyNode_Text(FileName,strText);
  607. if (!result)
  608. {
  609. cout << "\n修改节点文本信息错误!" << endl;
  610. }
  611. else
  612. {
  613. cout << "\n修改名字为:" << strNodeName << "节点信息为" << strText << endl;
  614. cout << "修改成功!\n" << endl;
  615. }
  616.  
  617. }//块6结束
  618.  
  619. {//块7开始
  620. //修改指定名字节点的属性的值
  621. map<string,string> AttMap_input;
  622. //name="MainFrame" x="5" y="15" w="400" h="250"
  623. AttMap_input.insert(pair<string,string>("name","_MainFrame"));
  624. AttMap_input.insert(pair<string,string>("x","_5"));
  625. AttMap_input.insert(pair<string,string>("y","_15"));
  626. AttMap_input.insert(pair<string,string>("w","_400"));
  627. AttMap_input.insert(pair<string,string>("h","_250"));
  628. string FileName(filename);
  629. string strNodeName("Window");
  630. bool result = ModifyNode_Attribute(FileName,AttMap_input);
  631. cout << result << endl;
  632. if (!result)
  633. {
  634. cout << "改变属性值操作失败!" << endl;
  635. }
  636. else
  637. {
  638. cout << "改变属性值操作成功!" << endl;
  639. }
  640. }//块7结束
  641.  
  642. {//块8开始
  643. //在指定名字的节点下面创建一个新的节点。并且设置新的节点的text内容
  644. string FileName(filename);
  645. string strParNodeName("Windows");
  646. string strNodeName("Window_new");
  647. string strText("This is a new Create Node!");
  648. bool result = AddNode_Text(FileName,strText);
  649. if (result)
  650. {
  651. cout << "创建指定名字:" << strNodeName << "的新节点成功!" << endl;
  652. }
  653. else
  654. {
  655. cout << "创建节点失败" << endl;
  656. }
  657. }//块8结束
  658.  
  659. {//块9开始
  660. //插入新的节点并设置节点的属性值。
  661. map<string,string>("_name",string>("_x",string>("_y",string>("_w",string>("_h","_250"));
  662. string FileName(filename);
  663. string strParNodeName("MyApp");
  664. string strNodeName("NewAtt");
  665. bool result = AddNode_Attribute(FileName,AttMap_input);
  666. if (result)
  667. {
  668. cout << "增加新的节点,并设置属性值成功" << endl;
  669. }
  670. else
  671. {
  672. cout << "增加新的节点,并设置属性值失败" << endl;
  673. }
  674. }//块9结束
  675.  
  676. {//块10,打印出整个的XML文档
  677. string FileName(filename);
  678. PintXML(FileName);
  679. }
  680.  
  681. getchar();
  682. return 0;
  683. }

猜你在找的XML相关文章