2024年1月13日发(作者:)

CComPtr pNode; CComBSTR bstr; for (long i = 0; i < iLen; ++i) { pNode = NULL; if (pList->get_item(i, &pNode) != S_OK) throw L"pList->get_item error!"; (); if (pNode->get_nodeName(&bstr) != S_OK) throw L"pNode->get_nodeName error!"; if (bstr == L"Command") { CComPtr pMapAttr; if (pNode->get_attributes(&pMapAttr) != S_OK) throw L"pNode->get_attributes error!"; wstring strName, strType, strValue; ReadValueOfAttr(pMapAttr, L"name", strName); ReadValueOfAttr(pMapAttr, L"type", strType); CComPtr pList; if (pNode->get_childNodes(&pList) != S_OK) throw L"pNode->get_childNodes error!"; long iLen = 0; if (pList->get_length(&iLen) != S_OK) throw L"pList->get_length error!"; CComPtr pParameter; CString strTmp; for (long i = 0; i < iLen; ++i) { pParameter = NULL; if (pList->get_item(i, &pParameter) != S_OK) throw L"pList->get_item error!"; pMapAttr = NULL; if (pParameter->get_attributes(&pMapAttr) != S_OK) throw L"pParameter->get_attributes error!"; ReadValueOfAttr(pMapAttr, L"type", strType); strValue = ReadValueOfNode(pParameter); //std::map myMapCommnd; std::map myMapCommnd; (pair(strType, strValue)); } } else if (bstr == "Element") { CComPtr pMapAttr; if (pNode->get_attributes(&pMapAttr) != S_OK) throw L"pNode->get_attributes error!"; wstring strName, strType, strValue; ReadValueOfAttr(pMapAttr, L"fullNameFormat", strName); if (wcscmp(L"winClass,name", strName.c_str()) == 0) { CComPtr pListProperty; if (pNode->get_childNodes(&pListProperty) != S_OK) throw L"pNode->get_childNodes error!"; long iLenProperty = 0; if (pListProperty->get_length(&iLenProperty) != S_OK)

if (pListProperty->get_length(&iLenProperty) != S_OK) throw L"pListProperty->get_length error!"; CComPtr pProperty; CComPtr pMapAttr; wstring strKey, strValue, strWeight, strAction; int iWeight = 0; for (long j = 0; j < iLenProperty; ++j) { pProperty = NULL; if (pListProperty->get_item(j, &pProperty) != S_OK) throw L"pList->get_item error!"; (); if (pProperty->get_nodeName(&bstr) != S_OK) throw L"pProperty->get_nodeName error!"; if (bstr != L"Property") throw L"bstr != Property error!"; pMapAttr = NULL; if (pProperty->get_attributes(&pMapAttr) != S_OK) throw L"pProperty->get_attributes error!"; ReadValueOfAttr(pMapAttr, L"key", strKey); ReadValueOfAttr(pMapAttr, L"weight", strWeight); strValue = ReadValueOfNode(pProperty); std::map myMapWinClass; (pair(strKey, strWeight)); } //ReadValueOfAttr(pMapAttr, L"type", strType); } else if (wcscmp(L"role,name", strName.c_str()) == 0) { CComPtr pListProperty; if (pNode->get_childNodes(&pListProperty) != S_OK) throw L"pNode->get_childNodes error!"; long iLenProperty = 0; if (pListProperty->get_length(&iLenProperty) != S_OK) throw L"pListProperty->get_length error!"; CComPtr pProperty; CComPtr pMapAttr; wstring strKey, strValue, strWeight, strAction; int iWeight = 0; for (long j = 0; j < iLenProperty; ++j) { pProperty = NULL; if (pListProperty->get_item(j, &pProperty) != S_OK) throw L"pList->get_item error!"; (); if (pProperty->get_nodeName(&bstr) != S_OK) throw L"pProperty->get_nodeName error!"; if (bstr != L"Property") throw L"bstr != Property error!"; pMapAttr = NULL; if (pProperty->get_attributes(&pMapAttr) != S_OK) throw L"pProperty->get_attributes error!"; ReadValueOfAttr(pMapAttr, L"key", strKey); ReadValueOfAttr(pMapAttr, L"weight", strWeight); strValue =

ReadValueOfNode(pProperty); std::map myMapRole; (pair(strKey, strWeight)); } // m_lDom(pNode); } } } } ::CoUninitialize();}int main(){ GetXmlText(); return 0;}