TiXmlDocument 에서 읽 은 메모리 의 xml 을 string 에 저장 합 니 다.
1394 단어 xml 분석
(1)
C/C++ code
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
TiXmlDocumen *pXMLDoc = new TiXmlDocument( "******" ); if (pXMLDoc != NULL) { pXMLDoc->LoadFile(); } TiXmlNode * pNode = pXMLDoc->FirstChild( "****" ); // **** // TiXmlElement* pXmlElement = pNode->ToElement(); // string strAttrib = pXmlElement->Attribute( "name" ) // name // text string strText = pXmlElement->GetText(); // , , while pXmlElement= pXmlElement->NextSiblingElement( "nextElement" ); (2) 최신 버 전의 tinyxml 를 다운로드 한 후 다음 코드 를 사용 합 니 다 (
CString 으로 출력, 변경 가능, string 으로 전송)
TiXmlPrinter printer;
TextElement->Accept(&printer);
strResult.Format("%s", printer.CStr());
.