怎麼樣把我下面的XML格式的文件裡面的結點中值循環讀出來
<?XML version="1.0" standalone="yes"?>
<InOutStore XMLns="http://tempuri.org/InOutStore.xsd">
<OutStore>
<code>6900916200010</code>
<time>2005-7-11 20:47:54</time>
</OutStore>
<OutStore>
<code>1P25-68596-01</code>
<time>2005-7-11 20:48:10</time>
</OutStore>
<OutStore>
<code>6901028337168</code>
<time>2005-7-11 20:48:20</time>
</OutStore>
<OutStore>
<code>6901028337168</code>
<time>2005-7-11 20:48:32</time>
</OutStore>
<OutStore>
<code>6901028337168</code>
<time>2005-7-11 20:48:41</time>
</OutStore>
<PocketId>
<pid>001</pid>
</PocketId>
</InOutStore>
用 節點[索引]的模式可以讀取重名節點, 下面是代碼
#if !defined(__MSXML3__)
#define __MSXML3__
#import "msXML3.dll"
using namespace MSXML2;
#endif
IXMLDOMDocument2Ptr XML;
xml.CreateInstance(__uuidof(MSXML2::DOMDocument));
xml->load("xxxx.XML");
CStringArray timeA, codeA;
int i= 1;
BOOL bNode = TRUE;
while (bNode)
{
IXMLDOMNodePtr node;
CString strRoot;
strRoot.Format("/InOutStore/OutStore[%d]", i++);
node=XML->selectSingleNode(_bstr_t(strRoot));
if (node)
{
IXMLDOMNodePtr nodeCode, nodeTime;
VARIANT value;
CString strCode = strRoot + "/code";
nodeCode=XML->selectSingleNode(_bstr_t(strCode));
nodeCode->get_nodeTypedValue(&value);
CString str1(value.bstrVal);
SysFreeString(value.bstrVal);
codeA.Add(str1);
CString strTime = strRoot + "/time";
nodeTime=XML->selectSingleNode(_bstr_t(strTime ));
nodeTime->get_nodeTypedValue(&value);
CString str2(value.bstrVal);
SysFreeString(value.bstrVal);
timeA.Add(str2);
}
else
bNode = FALSE;
}