本文整理汇总了C++中msxml2::IXMLDOMNodeListPtr::Getitem方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMNodeListPtr::Getitem方法的具体用法?C++ IXMLDOMNodeListPtr::Getitem怎么用?C++ IXMLDOMNodeListPtr::Getitem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msxml2::IXMLDOMNodeListPtr
的用法示例。
在下文中一共展示了IXMLDOMNodeListPtr::Getitem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckVersionUpdate
BOOL CAutoUpdateDlg::CheckVersionUpdate(CString& strUpdateURL)
{
BOOL bHasUpdate = FALSE;
HRESULT hr = S_OK;
IXMLHTTPRequestPtr pHttpRequest;
IDispatchPtr pDispatch;
MSXML2::IXMLDOMDocumentPtr pXmlDoc;
MSXML2::IXMLDOMNodeListPtr pList;
MSXML2::IXMLDOMElementPtr pChild;
UINT nFileSize;
CString strFileName, strFileVer, strMD5String;
LONG lElementCount = 0L;
try
{
hr = pHttpRequest.CreateInstance(TEXT("Msxml2.XMLHTTP.3.0"));
if( FAILED(hr) )
_com_issue_error(hr);
hr = pHttpRequest->open(TEXT("GET"), (_bstr_t)strUpdateURL, false);
if( FAILED(hr) )
_com_issue_error(hr);
hr = pHttpRequest->send();
if( FAILED(hr) )
_com_issue_error(hr);
if (pHttpRequest->Getstatus() != 200)
throw (0);
pDispatch = pHttpRequest->GetresponseXML();
hr = pDispatch->QueryInterface(pXmlDoc.GetIID(), (void**)&pXmlDoc);
if( FAILED(hr) )
_com_issue_error(hr);
pList = pXmlDoc->selectNodes("/manifest/filelist/file");
lElementCount = pList->Getlength();
for( LONG i = 0; i < lElementCount; i++ )
{
pChild = pList->Getitem(i);
strFileName = pChild->getAttribute("filename");
nFileSize = pChild->getAttribute("filesize");
strFileVer = pChild->getAttribute("fileversion");
strMD5String = pChild->getAttribute("md5");
//如果本地文件存在则效验文件,不存在就下载这个文件
if (PathFileExists(m_strCurrentDir+strFileName))
{
//效验文件,如果MD5码不相同则重新下载
if (CMD5Checksum::GetMD5(m_strCurrentDir+strFileName) != strMD5String)
{
m_ulTotalLength += nFileSize;
m_DownloadMgr.AddTask(strFileName);
bHasUpdate = TRUE;
}
}
else
{
m_ulTotalLength += nFileSize;
m_DownloadMgr.AddTask(strFileName);
bHasUpdate = TRUE;
}
}
return bHasUpdate;
}
#ifdef _DEBUG
catch(_com_error& e)
{
CString strError;
strError.Format(_T("Error code:%d\nMessage:%s\nDescrption:%s"), (int)e.WCode(), e.ErrorMessage(), (TCHAR*)e.Description());
MessageBox(strError, _T("提示"), MB_OK|MB_ICONWARNING);
return FALSE;
}
#endif
catch(...)
{
return FALSE;
}
}
示例2: LoadShootSolutionSector
void CShootManagerSys::LoadShootSolutionSector(int iSector, LPCTSTR szFilename)
{
if(iSector >= m_ShootSolutionSectorArray.Num()) return;
int i;
MSXML2::IXMLDOMDocument2Ptr pDoc;
pDoc.CreateInstance(__uuidof(DOMDocument40));
pDoc->load((_variant_t)szFilename);
// 성공한 슛부터 로드한다.
MSXML2::IXMLDOMNodeListPtr pNodeListSuccess = pDoc->selectNodes(L"root/success");
for(i=0; i<pNodeListSuccess->Getlength(); i++)
{
MSXML2::IXMLDOMNodePtr pNodeSuccess = pNodeListSuccess->Getitem(i);
CShootSolution Solution;
Solution.Create(pNodeSuccess, true, this);
m_ShootSolutionSectorArray[iSector].first.push_back(Solution);
}
MSXML2::IXMLDOMNodeListPtr pNodeListFail = pDoc->selectNodes(L"root/fail");
for(i=0; i<pNodeListFail->Getlength(); i++)
{
MSXML2::IXMLDOMNodePtr pNodeFail = pNodeListFail->Getitem(i);
CShootSolution Solution;
Solution.Create(pNodeFail, false, this);
m_ShootSolutionSectorArray[iSector].second.push_back(Solution);
}
pDoc.Release();
}
示例3: nLoadTestCases
/******************************************************************************
Function Name : nLoadTestCases
Input(s) : MSXML2::IXMLDOMNodePtr& pTSDOM
Output : INT
Functionality :
Member of : CTestSetupEntity
Friend of : -
Author(s) : Venkatanarayana Makam, GT-Derka
Date Created : 06/04/2011
Modifications :
Codetag : CS004
******************************************************************************/
INT CTestSetupEntity::nLoadTestCases(MSXML2::IXMLDOMNodePtr& pTSDOM)
{
LONG lDefaultChannelUsed = 0;
LONG lCount;
_bstr_t bstrNodeName(def_STR_TESTCASE_NODE);
MSXML2::IXMLDOMNodeListPtr pDOMTCNodeList;
MSXML2::IXMLDOMNodePtr pIXMLDOMTestCase;
pDOMTCNodeList = pTSDOM->selectNodes(bstrNodeName);
pDOMTCNodeList->get_length(&lCount);
for(int i=0; i<lCount; i++)
{
CTestCaseEntity odTestCaseEntity;
pIXMLDOMTestCase = pDOMTCNodeList->Getitem(i);
odTestCaseEntity.GetData(pIXMLDOMTestCase);
m_odTestCaseEntityList.AddTail(odTestCaseEntity);
lDefaultChannelUsed += odTestCaseEntity.m_lDefaultChannelUsed;
}
if(lDefaultChannelUsed == 1)
{
AfxMessageBox(_("1 entity without channel-information loaded.\nCAN-Channel 1 selected."), MB_OK | MB_ICONINFORMATION );
}
else if(lDefaultChannelUsed > 1)
{
CString str;
str.Format("%d", lDefaultChannelUsed);
AfxMessageBox(str + _(" entities without channel-information loaded.\nCAN-Channel 1 selected in each case."), MB_OK | MB_ICONINFORMATION );
}
return S_OK;
}
示例4: readVerticesNormalsTexcoords
void readVerticesNormalsTexcoords(MSXML2::IXMLDOMNodePtr mesh, geometry_t &geometry)
{
MSXML2::IXMLDOMNodeListPtr sourceList = mesh->selectNodes("r:source");
vector<float> vertices;
vector<float> normals;
vector<float> texcoords;
for (int i = 0; i < sourceList->length; i++)
{
MSXML2::IXMLDOMNodePtr source = sourceList->Getitem(i);
MSXML2::IXMLDOMNamedNodeMapPtr attributes = source->attributes;
for (int j = 0; j < attributes->length; j++)
{
_bstr_t attributeName = attributes->getNamedItem("id")->text;
if (wcsstr(_wcslwr(attributeName), L"position"))
{
geometry.vertices = readArray<float>(source);
} else if (wcsstr(_wcslwr(attributeName), L"normal"))
{
geometry.normals = readArray<float>(source);
} else if (wcsstr(_wcslwr(attributeName), L"map") || // belnder
wcsstr(_wcslwr(attributeName), L"-uv")) // 3dsmax
{
geometry.texcoords = readArray<float>(source);
}
}
}
}
示例5: SetNodeValue
//设置指定xpath的节点值
BOOL CXmlBase::SetNodeValue(LPCTSTR lpszValue, LPCTSTR lpszXPath
, MSXML2::IXMLDOMDocument2Ptr pDoc)
{
if (pDoc == NULL || lpszXPath == NULL) return FALSE;
MSXML2::IXMLDOMNodeListPtr pNodeList = pDoc->selectNodes(lpszXPath);
long lCnt = pNodeList->Getlength();
if (lCnt == 0) return FALSE;
MSXML2::IXMLDOMNodePtr pNode = pNodeList->Getitem(0);
return SetNodeValue(lpszValue, pNode);
}
示例6: PickUpGroups
BOOL CIconImgList::PickUpGroups( MSXML2::IXMLDOMElementPtr& piGroup, int& nIndex)
{
MSXML2::IXMLDOMNodeListPtr piGroupList;
piGroupList = piGroup->GetchildNodes();
MSXML2::IXMLDOMElementPtr piNode;
MSXML2::IXMLDOMElementPtr piChild;
int nParent = nIndex;
_bstr_t cBstr;
_variant_t cVariant;
long lCount = piGroupList->Getlength();
for( long lIndex = 0; lIndex < lCount; lIndex++)
{
piNode = piGroupList->Getitem( lIndex);
if( _bstr_t( _T( "GROUP")) == piNode->GetbaseName())
{
cBstr = piNode->getAttribute( _bstr_t( _T( "TITLE")));
cVariant = piNode->getAttribute( _bstr_t( _T( "ENABLE")));
cVariant.ChangeType( VT_BOOL);
m_astGroupData[ nIndex] = ( GROUPDATA*)malloc( sizeof( GROUPDATA) + ( sizeof( TCHAR) * ( cBstr.length() + 1)));
m_astGroupData[ nIndex]->nParent = nParent;
if( 1 <= nIndex)
{
if( FALSE == m_astGroupData[ nParent]->blEnable)
{
cVariant.boolVal = VARIANT_FALSE;
}
}
m_astGroupData[ nIndex]->blEnable = ( VARIANT_FALSE == cVariant.boolVal) ? FALSE : TRUE;
lstrcpy( m_astGroupData[ nIndex]->szName, cBstr);
nIndex++;
PickUpGroups( piNode, nIndex);
}
else if( _bstr_t( _T( "ITEM")) == piNode->GetbaseName())
{
cVariant = piNode->getAttribute( _bstr_t( _T( "REF")));
cVariant.ChangeType( VT_I4);
for( int nIndex = 0; nIndex < m_nEnableCount; nIndex++)
{
if( cVariant.intVal == ( m_astIconStatus[ nIndex].nID + 1))
{
m_astIconStatus[ nIndex].nParent = nParent;
}
}
}
}
return TRUE;
}
示例7: GetCommonVerifyData
/******************************************************************************
Function Name : GetData
Input(s) :
Output : HRESULT
Functionality :
Member of : CVerifyEntity
Friend of : -
Author(s) : Venkatanarayana Makam
Date Created : 06/04/2011
Modifications :
******************************************************************************/
HRESULT CVerifyEntity::GetCommonVerifyData(MSXML2::IXMLDOMNodePtr& pIDomNode, CVerifyData *verifyData)
{
m_ouData = verifyData;
_bstr_t bstrNodeName = def_STR_VERIFYMSG_NODE;
CComVariant NodeValue;
MSXML2::IXMLDOMNamedNodeMapPtr pDOMVerifyAtrributes;
MSXML2::IXMLDOMNodePtr pIDOMChildNode;
pDOMVerifyAtrributes = pIDomNode->Getattributes();
//bstrNodeName = L"failure";
bstrNodeName.Assign(SysAllocString(CT2W("failure")));
pIDOMChildNode = pDOMVerifyAtrributes->getNamedItem(bstrNodeName);
pIDOMChildNode->get_nodeTypedValue(&NodeValue);
CString strTemp;
strTemp = strCopyBSTRToCString(NodeValue);
//m_ouData = new CVerifyData();
if(strTemp == "SUCCESS")
{
m_ouData->m_eAttributeError = SUCCESS;
}
else if(strTemp == "WARNING")
{
m_ouData->m_eAttributeError = WARNING;
}
else if(strTemp == "ERRORS")
{
m_ouData->m_eAttributeError = ERRORS;
}
else
{
m_ouData->m_eAttributeError = FATAL;
}
MSXML2::IXMLDOMNodeListPtr pIDOMSendList;
LONG lCount;
//bstrNodeName = def_STR_VERIFYMSG_NODE;
bstrNodeName.Assign(SysAllocString(CT2W(def_STR_VERIFYMSG_NODE)));
pIDOMSendList = pIDomNode->selectNodes(bstrNodeName);
pIDOMSendList->get_length(&lCount);
for(int i = 0; i < lCount; i++)
{
CVerifySubEntity *odVerifySubEntity;
MSXML2::IXMLDOMNodePtr pIXMLDOMVerifyMsgEntity;
pIXMLDOMVerifyMsgEntity = pIDOMSendList->Getitem(i);
//if(CVerifySubEntity::GetData(&odVerifySubEntity, pIXMLDOMVerifyMsgEntity) == S_OK)
if(this->GetSubEntityData(&odVerifySubEntity, pIXMLDOMVerifyMsgEntity) == S_OK)
{
m_ouData->m_odVerifySubEntityList.push_back(odVerifySubEntity);
}
}
return S_OK;
}
示例8: readGeometry
void readGeometry(dae_reader_t *reader, MSXML2::IXMLDOMDocument2Ptr xmlDoc)
{
MSXML2::IXMLDOMNodeListPtr nodeList;
nodeList = xmlDoc->selectNodes("/r:COLLADA/r:library_geometries/r:geometry");
int count = nodeList->length;
for (int i = 0; i < count; i++)
{
MSXML2::IXMLDOMNodePtr node = nodeList->Getitem(i);
readMesh(reader, node);
}
}
示例9: OnBnClickedLoadItem
//装入项目
void CUpdateBuilderDlg::OnBnClickedLoadItem()
{
CFileDialog dlg(TRUE, _T("*.xml"), _T("update.xml"), OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, _T("XML File(*.xml)|*.xml||"));
if (dlg.DoModal() == IDOK)
{
HRESULT hr = S_OK;
MSXML2::IXMLDOMDocumentPtr pXmlDoc;
MSXML2::IXMLDOMNodeListPtr pNodeList;
MSXML2::IXMLDOMElementPtr pElement;
try
{
hr = pXmlDoc.CreateInstance(__uuidof(MSXML2::DOMDocument30));
if( FAILED( hr ) )
_com_issue_error(hr);
pXmlDoc->load(CComVariant(dlg.GetPathName()));
pNodeList = pXmlDoc->selectNodes("/manifest/filelist/file");
m_FileListCtrl.DeleteAllItems();
LONG lItemCount = pNodeList->Getlength();
int nItem;
for (LONG lIndex = 0; lIndex < lItemCount; lIndex++)
{
pElement = pNodeList->Getitem(lIndex);
nItem = m_FileListCtrl.InsertItem(0, CString(pElement->getAttribute("filename")));
m_FileListCtrl.SetItemText(nItem, 1, CString(pElement->getAttribute("filesize")));
m_FileListCtrl.SetItemText(nItem, 2, CString(pElement->getAttribute("fileversion")));
m_FileListCtrl.SetItemText(nItem, 3, CString(pElement->getAttribute("md5")));
m_FileListCtrl.SetItemData(nItem, (ULONG)pElement->getAttribute("filesize"));
}
SetWindowText(dlg.GetPathName());
GetDlgItem(IDC_UPDATE_ITEM)->EnableWindow(TRUE);
}
catch(_com_error& e)
{
CString strError;
strError.Format(_T("Error code:%d\nError Message:%s\nError Description:%s"),
(int)e.WCode(), e.ErrorMessage(), (char*)e.Description());
MessageBox(strError, _T("错误"),MB_OK|MB_ICONSTOP);
}
}
}
示例10: RemoveNodes
void CXmlNodeWrapper::RemoveNodes(LPCTSTR searchStr)
{
if (!IsValid())
return;
MSXML2::IXMLDOMNodeListPtr nodeList = m_xmlnode->selectNodes(searchStr);
for (int i = 0; i < nodeList->Getlength(); i++)
{
try
{
MSXML2::IXMLDOMNode* pNode = nodeList->Getitem(i).Detach();
pNode->GetparentNode()->removeChild(pNode);
}
catch (_com_error er)
{
AfxMessageBox(er.ErrorMessage());
}
}
}
示例11: nLoadTestCases
/******************************************************************************
Function Name : nLoadTestCases
Input(s) : MSXML2::IXMLDOMNodePtr& pTSDOM
Output : INT
Functionality :
Member of : CTestSetupEntity
Friend of : -
Author(s) : Venkatanarayana Makam
Date Created : 06/04/2011
Modifications :
Codetag : CS004
******************************************************************************/
INT CTestSetupEntity::nLoadTestCases(MSXML2::IXMLDOMNodePtr& pTSDOM)
{
LONG lCount;
_bstr_t bstrNodeName(def_STR_TESTCASE_NODE);
MSXML2::IXMLDOMNodeListPtr pDOMTCNodeList;
MSXML2::IXMLDOMNodePtr pIXMLDOMTestCase;
pDOMTCNodeList = pTSDOM->selectNodes(bstrNodeName);
pDOMTCNodeList->get_length(&lCount);
for(int i=0; i<lCount;i++)
{
CTestCaseEntity odTestCaseEntity;
pIXMLDOMTestCase = pDOMTCNodeList->Getitem(i);
odTestCaseEntity.GetData(pIXMLDOMTestCase);
m_odTestCaseEntityList.AddTail(odTestCaseEntity);
}
return S_OK;
}
示例12: Translate
void Translator::Translate(IEnginePtr engine, InputStreamPtr readStream, SequenceFilePtr seqFile, TSError *error, char* errorMsg, long maxErrorMsgLengthInBytes)
{
GetParser()->LoadFile(readStream);
std::string seqName = GetParser()->GetSequenceName();
SequencePtr seq = engine->NewSequence();
seq->Name = seqName.c_str();
seqFile->InsertSequence(seq);
m_totalSteps = 0;
MSXML2::IXMLDOMNodeListPtr stepList = GetParser()->GetStepList();
for ( int i = 0; i < stepList->length; ++i)
{
MSXML2::IXMLDOMNodePtr currentStep = stepList->Getitem(i);
AddStep(engine, currentStep, GetParser()->GetStepProperties(currentStep), GetParser()->GetStepName(currentStep), seqFile, seqName);
}
//set the version property on the SequenceFile object
std::string versionInfo;
GetFileVersion(versionInfo, readStream, error, errorMsg, maxErrorMsgLengthInBytes);
if( *error == TS_Err_NoError)
seqFile->AsPropertyObjectFile()->Version = versionInfo.c_str();
}
示例13: SetAttrValue
//设置指定xpath的节点属性
BOOL CXmlBase::SetAttrValue(LPCTSTR lpszValue, LPCTSTR lpszAttrName, LPCTSTR lpszXPath
, MSXML2::IXMLDOMDocument2Ptr pDoc)
{
MSXML2::IXMLDOMNodePtr pNode = NULL;
MSXML2::IXMLDOMNodeListPtr pNodeList = NULL;
long lCnt = 0;
if (pDoc == NULL || lpszXPath == NULL) return FALSE;
try
{
pNodeList = pDoc->selectNodes(lpszXPath);
lCnt = pNodeList->Getlength();
if (lCnt == 0) return FALSE;
pNode = pNodeList->Getitem(0);
}
catch (_com_error e)
{
::MessageBox(NULL, e.ErrorMessage(), NULL, MB_OK|MB_ICONERROR);
return FALSE;
}
return SetAttrValue(lpszValue, lpszAttrName, pNode);
}
示例14: GetGroupCount
long CIconImgList::GetGroupCount( MSXML2::IXMLDOMElementPtr piGroups)
{
long lCount = 0;
MSXML2::IXMLDOMNodeListPtr piGroupsList;
piGroupsList = piGroups->selectNodes( _bstr_t( _T( "GROUP")));
if( NULL != piGroupsList)
{
long lChildCount = piGroupsList->Getlength();
lCount = lChildCount;
MSXML2::IXMLDOMElementPtr piGroupChild;
for( long lIndex = 0; lIndex < lChildCount; lIndex++)
{
piGroupChild = piGroupsList->Getitem( lIndex);
lCount += GetGroupCount( piGroupChild);
}
}
return lCount;
}
示例15: readTriangles
void readTriangles(MSXML2::IXMLDOMNodePtr mesh, geometry_t &geometry)
{
MSXML2::IXMLDOMNodeListPtr polyLists = mesh->selectNodes("r:polylist"); // blender
MSXML2::IXMLDOMNodePtr p;
if (polyLists->length == 0)
polyLists = mesh->selectNodes("r:triangles"); // 3dsmax
for (int i = 0; i < polyLists->length; i++)
{
MSXML2::IXMLDOMNodePtr polylist = polyLists->item[i];
MSXML2::IXMLDOMNodePtr p = polylist->selectSingleNode("r:p");
if (p == NULL) continue;
geometry.vertexOffset.push_back(-1);
geometry.normalOffset.push_back(-1);
geometry.texcoordOffset.push_back(-1);
MSXML2::IXMLDOMNodeListPtr inputList = polylist->selectNodes("r:input");
for (int j = 0; j < inputList->length; j++)
{
MSXML2::IXMLDOMNodePtr input = inputList->Getitem(j);
MSXML2::IXMLDOMNamedNodeMapPtr attributes = input->attributes;
string semantic = (_bstr_t)_wcslwr((wchar_t *)attributes->getNamedItem("semantic")->text);
int offset = _wtoi(attributes->getNamedItem("offset")->text);
if (semantic == "vertex")
geometry.vertexOffset[geometry.vertexOffset.size() - 1] = offset;
else if (semantic == "normal")
geometry.normalOffset[geometry.normalOffset.size() - 1] = offset;
else if (semantic == "texcoord")
geometry.texcoordOffset[geometry.texcoordOffset.size() - 1] = offset;
}
vector<int> v = readValues<int>(p);
geometry.triangles.push_back(v);
}
}