http://www.firstobject.com/dn_markup.htm
CMarkup: fast simple C++ XML parser
http://www.gisdeveloper.co.kr/499
[C++] XML 파서, CMarkup 설명 소개.
------------------------------------------
#include "stdafx.h"
#include "../Markup.h"
int _tmain(int argc, _TCHAR* argv[])
{
CMarkup xml;
xml.AddElem( "ORDER" );
xml.AddChildElem( "ITEM" );
xml.IntoElem();
xml.AddAttrib("type", "A");
xml.AddChildElem( "SN", "132487A-J" );
xml.AddChildElem( "NAME", "crank casing" );
xml.AddChildElem( "QTY", "1" );
xml.OutOfElem();
xml.AddChildElem( "ITEM" );
xml.IntoElem();
xml.AddAttrib("type", "C");
xml.AddChildElem( "SN", "434417F-Y" );
xml.AddChildElem( "NAME", "kully casing" );
xml.AddChildElem( "QTY", "2" );
xml.OutOfElem();
std::string csXML = xml.GetDoc();
printf("%s", csXML.c_str());
return 0;
}
------------------------------------------
CMarkup xml;
xml.Load("d:/data.xml");
while ( xml.FindChildElem("ITEM") )
{
xml.IntoElem();
xml.FindChildElem( "NAME" );
std::string csSN = xml.GetChildData();
xml.FindChildElem( "QTY" );
int nQty = atoi(xml.GetChildData().c_str());
xml.OutOfElem();
printf("%s, %d\n", csSN.c_str(), nQty);
}
------------------------------------------
CXml myXML;
myXML.LoadXml( (LPCTSTR) m_strXML );
myXML.SaveWithFormatted(lpszPathName, _T("UTF-8") ); ///default is UTF-8
myXML.Close();