提供几个函数: //----查看所有UserID---- CMarkup xml; xml.Load("UserInfo.xml"); BOOL bFind = true; xml.ResetMainPos(); while (xml.FindChildElem("UserID");) { //此时接点还是父接点 CString strTagName = _T(""); CString strData = _T(""); strTagName = xml.GetChildTagName(); strData = xml.GetChildData(); TRACE("\n---tagName:%s,Data:%s--\n",strTagName,strData); } 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/kenkao/archive/2009/03/27/4030158.aspx 此外,需要了解关于FindChildElem的用法: If there is a main position and no current child position, FindChildElem() locates the first child element under the main position and makes it the child position. If there is a child element, it moves to the next child element. If there is no child element or no next child element, it returns false and leaves the child position where it was.详细的信息还要到网站看:http://www.firstobject.com/dn_FindChildElem.htm; 不是什么难问题,建议先google一下
xml.FindElem();
xml.IntoElem();
xml.FindElem();
AfxMessageBox(xml.GetData());
<a>
<b>
<d>tttt</d>
<c>1234</c>
<d>ssss</d>
</b>
</a>
http://download.csdn.net/source/992877
CMarkup官网地址
http://www.firstobject.com/判断xml是否结构正确用 .IsWellFormed();
xml.FindElem();
xml.IntoElem();
xml.FindElem();
AfxMessageBox(xml.GetData());
下面的显然不是XML结构的东西了,去解析字符串吧。tttt
<c>1234</c>
ssss
//----查看所有UserID----
CMarkup xml;
xml.Load("UserInfo.xml");
BOOL bFind = true;
xml.ResetMainPos();
while (xml.FindChildElem("UserID");)
{
//此时接点还是父接点
CString strTagName = _T("");
CString strData = _T("");
strTagName = xml.GetChildTagName();
strData = xml.GetChildData();
TRACE("\n---tagName:%s,Data:%s--\n",strTagName,strData);
}
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/kenkao/archive/2009/03/27/4030158.aspx
此外,需要了解关于FindChildElem的用法:
If there is a main position and no current child position, FindChildElem() locates the first child element under the main position and makes it the child position. If there is a child element, it moves to the next child element. If there is no child element or no next child element, it returns false and leaves the child position where it was.详细的信息还要到网站看:http://www.firstobject.com/dn_FindChildElem.htm;
不是什么难问题,建议先google一下