¹ØÓÚÀûÓÃcmarkupÀཫxmlת³ÉÊ÷µÄµÝ¹é´úÂë
½üÀ´×Ô¼ºÔÚ×öxmlµÄ½âÎöÆ÷¡£ÀûÓõ½ÁËcmarkupÀ࣬¾Íµ±×ö´æ´¢°É£¡ÓÐÐèÒªµÄÅóÓÑ¿ÉÒÔÃ鼸ÑÛ¡£
HTREEITEM itemTemp1,itemTemp2;
CString str1,str2;
char strtemp[100];
static bool result = true;
strtemp[0] = 0;
if (result)
{
xml.FindElem();
}
result = false;
str1 = xml.GetTagName();
strcpy(strtemp,(char*)(LPCTSTR)str1);
itemTemp1 = m_treectrl.InsertItem(str1,item);
if (xml.FindChildElem())
{
xml.IntoElem();
LoadXmlItem(itemTemp1);
xml.OutOfElem();
}
while(xml.FindElem())
{
str1 = xml.GetTagName();
strcpy(strtemp,(char*)(LPCTSTR)str1);
itemTemp2 = m_treectrl.InsertItem(str1,item);
if (xml.FindChildElem())
{
xml.IntoElem();
AfxMessageBox("cc");
LoadXmlItem(itemTemp2);
xml.OutOfElem();
}
//nRes = xml.FindElem();
}
Óöµ½¸öÎÊÌ⣺ ²»ÖªµÀÈçºÎ»ñÈ¡ÊôÐÔÃû³ÆºÍÊôÐÔµÄÊýÁ¿ÎÊÌ⣬ÍûÖªµÀµÄÅóÓÑÄܰï°ïÔÚÏ¡£
Ïà¹ØÎĵµ£º
½ÓÉÏһƪ
ɾ³ýÔgenreÊôÐÔ£¬É¾³ýleixing=loveµÄËùÓнáµã¡£
1 ÔxmlÎļþ bookstore.xml
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="love" ISBN="1234123">
<title>who am i </title>
<author>who</aut ......
½ÓÉÏһƪ
ÏÔʾËùÓнáµãµÄÄÚÈÝ
1 ÔxmlÎļþ bookstore.xml
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book ISBN="1234123">
<title>who am i </title>
<author>who</author>
<price> ......
http://topic.csdn.net/t/20021102/16/1142056.html
use classes in System.Xml namespace, for example (assume your xml is in string s and it contains an xmlns definition) ......
DOM³õ²½
DOMÊÇDocument Object ModelµÄËõд£¬¼´Îĵµ¶ÔÏóÄ£ÐÍ¡£Ç°ÃæËµ¹ý£¬XML½«Êý¾Ý×é֯Ϊһ¿ÅÊ÷£¬ËùÒÔDOM¾ÍÊǶÔÕâ¿ÅÊ÷µÄÒ»¸ö¶ÔÏóÃèÐð¡£Í¨Ë×µÄ˵£¬¾ÍÊÇͨ¹ý½âÎöXMLÎĵµ£¬ÎªXMLÎĵµÔÚÂß¼ÉϽ¨Á¢Ò»¸öÊ÷Ä£ÐÍ£¬Ê÷µÄ½ÚµãÊÇÒ»¸ö¸ö¶ÔÏó¡£ÎÒÃÇͨ¹ý´æÈ¡ÕâЩ¶ÔÏó¾ÍÄܹ»´æÈ¡XMLÎĵµµÄÄÚÈÝ¡£
ÏÂÃæÎÒÃÇÀ´¿´Ò»¸ö¼òµ¥µÄÀý×Ó£¬¿´¿´ÔÚDOMÖ ......
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE hibernate-configuration (View Source for full doctype...)>
- <!-- Generated by MyEclipse Hibernate Tools.
--> - <!-- ÒÔÉϼ¸ÐÐËùÓеÄhibernate.cfg.xml¶¼Ïàͬ
--> [url=file:///C:/Documents%20and%20Settings/ ......