xml
下面的代码可以完成从一个XML文件找到名字为time的全部节点的功能
IXMLDOMNodeList *pIDOMNodeList = NULL;
IXMLDOMNode *pIDOMNode = NULL;
long value;
BSTR bstrItemText;
HRESULT hr;
BSTR tag = SysAllocString(L"time");
hr = pXMLDoc->getElementsByTagName(
(tag , &pIDOMNodeList);
hr = pIDOMNodeList->get_length(&value);
if(SUCCEEDED(hr))
{
pIDOMNodeList->reset();
for(int ii = 0; ii < value; ii++)
{
pIDOMNodeList->get_item(ii, &pIDOMNode);
if(pIDOMNode )
{
pIDOMNode->get_text(&bstrItemText);
::MessageBox(NULL, bstrItemText,"time", MB_OK);
pIDOMNode->Release();
pIDOMNode = NULL;
}
}
}
pIDOMNodeList->Release();
pIDOMNodeList = NULL;
SysFreeString(tag);