本文整理汇总了C++中msxml2::IXMLDOMNodePtr::GetchildNodes方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMNodePtr::GetchildNodes方法的具体用法?C++ IXMLDOMNodePtr::GetchildNodes怎么用?C++ IXMLDOMNodePtr::GetchildNodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msxml2::IXMLDOMNodePtr
的用法示例。
在下文中一共展示了IXMLDOMNodePtr::GetchildNodes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateToolbars
void CreateToolbars()
{
if (Glb_toolbarArray.GetCount() > 0)
return;
IAcadMenuGroup *mnuGrp = NULL;
if (!getAcadMenuGroup(&mnuGrp))
return ;
IAcadToolbars *tlbrs = NULL;
HRESULT hr = S_OK;
hr = mnuGrp->get_Toolbars(&tlbrs);
mnuGrp->Release();
// 得到arx所在路径
TCHAR lpPath[MAX_PATH] = {0};
GetModuleFileName(GetModuleHandle("DistToolBar.arx"), lpPath, MAX_PATH);
PathRemoveFileSpec(lpPath);
PathAddBackslash(lpPath);
CString strXmlFile = lpPath;
strXmlFile += "toolbar.xml";
// 得到icon路径
PathAppend(lpPath, "icon");
PathAddBackslash(lpPath);
MSXML2::IXMLDOMDocumentPtr lpDocument;
hr = lpDocument.CreateInstance(__uuidof(DOMDocument));
if ( FAILED(hr) )
_com_raise_error(hr);
VARIANT_BOOL isSuccessful;
// 装载XML字符串
if (!lpDocument->load(_variant_t(strXmlFile)))
{
OutputDebugString("LoadXML failed!");
return;
}
MSXML2::IXMLDOMElementPtr lpDocElement = NULL;
lpDocument->get_documentElement(&lpDocElement);
// toolbar list
MSXML2::IXMLDOMNodeListPtr lpToolbarList = lpDocElement->getElementsByTagName(_bstr_t("toolbar"));
MSXML2::IXMLDOMNodePtr lpToolbar = NULL;
for ( ; (lpToolbar = lpToolbarList->nextNode()) != NULL ; )
{
MSXML2::IXMLDOMNodePtr lpCaptionNode = lpToolbar->attributes->getNamedItem("caption");
CString strCaption = (char*)lpCaptionNode->text;
OutputDebugString(strCaption);
// 添加工具条
IAcadToolbar *tlbr = NULL;
hr = tlbrs->Add(CComBSTR(strCaption), &tlbr);
if FAILED(hr)
continue;
Glb_toolbarArray.Add(strCaption);
// button list
MSXML2::IXMLDOMNodeListPtr lpButtonList = lpToolbar->GetchildNodes();
MSXML2::IXMLDOMNodePtr lpButton = NULL;
for ( ; (lpButton = lpButtonList->nextNode()) != NULL ; )
{
MSXML2::IXMLDOMNodePtr lpToolTipNode = lpButton->attributes->getNamedItem("tooltip");
CString strToolTip = (char*)lpToolTipNode->text;
MSXML2::IXMLDOMNodePtr lpCommandNode = lpButton->attributes->getNamedItem("command");
CString strCommand = (char*)lpCommandNode->text;
strCommand += " ";
MSXML2::IXMLDOMNodePtr lpIconNode = lpButton->attributes->getNamedItem("icon");
CString strIcon = (char*)lpIconNode->text;
OutputDebugStringX("tooltip=%s, command=%s, icon=%s", strToolTip, strCommand, strIcon);
// 添加工具按钮
IAcadToolbarItem *button=NULL;
VARIANT index;
index.vt = VT_I4;
index.lVal = 100l;
VARIANT vtFalse;
vtFalse.vt = VT_BOOL;
vtFalse.boolVal = VARIANT_FALSE;
CString strIconFile = lpPath;
strIconFile += strIcon;
//.........这里部分代码省略.........
示例2: GetData
/******************************************************************************
Function Name : GetData
Input(s) : MSXML2::IXMLDOMNodePtr& pIDomNode
Output : HRESULT
Functionality : Fills the datastructure from the XML node
Member of : CTestCaseEntity
Friend of : -
Author(s) : Venkatanarayana Makam
Date Created : 06/04/2011
Modifications :
******************************************************************************/
HRESULT CTestCaseEntity::GetData(MSXML2::IXMLDOMNodePtr& pIDomNode)
{
//Getting Attributes
_bstr_t bstrNodeName;
CComVariant NodeValue;
MSXML2::IXMLDOMNamedNodeMapPtr pDOMTCAtrributes;
pDOMTCAtrributes = pIDomNode->Getattributes();
MSXML2::IXMLDOMNodePtr pIDOMChildNode;
//bstrNodeName = L"identifier";
bstrNodeName.Assign(SysAllocString(CT2W("identifier")));
pIDOMChildNode = pDOMTCAtrributes->getNamedItem(bstrNodeName);
pIDOMChildNode->get_nodeTypedValue(&NodeValue);
m_ouData.m_omID = strCopyBSTRToCString(NodeValue);
pIDOMChildNode.Release();
//bstrNodeName = L"title";
bstrNodeName.Assign(SysAllocString(CT2W("title")));
pIDOMChildNode = pDOMTCAtrributes->getNamedItem(bstrNodeName);
pIDOMChildNode->get_nodeTypedValue(&NodeValue);
m_ouData.m_omTitle = strCopyBSTRToCString(NodeValue);
pIDOMChildNode.Release();
//bstrNodeName = L"exp_handler";
bstrNodeName.Assign(SysAllocString(CT2W("exp_handler")));
pIDOMChildNode = pDOMTCAtrributes->getNamedItem(bstrNodeName);
pIDOMChildNode->get_nodeTypedValue(&NodeValue);
CString strTemp;
strTemp = strCopyBSTRToCString(NodeValue);
pIDOMChildNode.Release();
if(strTemp == "CONTINUE")
{
m_ouData.m_eExcpAction = CONTINUE;
}
else
{
m_ouData.m_eExcpAction = EXIT;
}
//Getting Testcases
MSXML2::IXMLDOMNodeListPtr pDOMChildList = pIDomNode->GetchildNodes();
LONG lCount;
pDOMChildList->get_length(&lCount);
CComBSTR NodeName;
for(int i = 0;i < lCount; i++)
{
pIDOMChildNode = pDOMChildList->Getitem(i);
pIDOMChildNode->get_nodeName(&NodeName);
CBaseEntityTA *odpBaseEntity = NULL;
if(NodeName == def_STR_SEND_NODE)
{
odpBaseEntity = new CSendEntity();
}
else if(NodeName == def_STR_VERIFY_NODE)
{
odpBaseEntity = new CVerifyEntity();
}
else if(NodeName == def_STR_WAIT_NODE)
{
odpBaseEntity = new CWaitEntity();
}
else if(NodeName == def_STR_REPLAY_NODE)
{
odpBaseEntity = new CReplayEntity();
}
else if(NodeName == def_STR_VERIFYRES_NODE)
{
odpBaseEntity = new CVerifyResponse();
}
if(odpBaseEntity == NULL)
{
//TODO::return a correct value
return -1;
}
odpBaseEntity->GetData(pIDOMChildNode);
m_ouData.m_odTAEntityList.AddTail(odpBaseEntity);
//pIDOMChildNode->Release();
}
return S_OK;
}