当前位置: 首页>>代码示例>>C++>>正文


C++ IXMLDOMNodePtr::GetnodeType方法代码示例

本文整理汇总了C++中msxml2::IXMLDOMNodePtr::GetnodeType方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMNodePtr::GetnodeType方法的具体用法?C++ IXMLDOMNodePtr::GetnodeType怎么用?C++ IXMLDOMNodePtr::GetnodeType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在msxml2::IXMLDOMNodePtr的用法示例。


在下文中一共展示了IXMLDOMNodePtr::GetnodeType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetLastElementChild

// 获取当前节点的最后一个Element子节点
IBpXMLNode* CBpXMLNode::GetLastElementChild() const
{
	if (m_pDOMNode == NULL)
		return NULL;

	if (m_pDOMNode->GetnodeType() == MSXML2::NODE_ELEMENT) 
	{ 
		MSXML2::IXMLDOMNodeListPtr pNodeList = m_pDOMNode->GetchildNodes(); 
		if (pNodeList == NULL)
			return NULL;
		long nListLen = 0;
		pNodeList->get_length(&nListLen);;
		MSXML2::IXMLDOMNodePtr pNode = NULL;
		for (long i = 0; i < nListLen; i++) 
		{ 
			pNodeList->get_item(nListLen - 1 - i, &pNode); 
			if (pNode->GetnodeType() == MSXML2::NODE_ELEMENT) 
			{ 
				CBpXMLNode *pNodeCreated  = new CBpXMLNode();	
				pNodeCreated->m_pDOMNode = pNode;
				return (IBpXMLNode*)pNodeCreated;
			} 
		} 
	}
	return NULL;
}
开发者ID:bjliugq,项目名称:SmartDoctor,代码行数:27,代码来源:ImplXMLNode.cpp

示例2: CBpXMLNode

// 获取当前节点的指定位置的Element子节点
IBpXMLNode *CBpXMLNode::GetElementChildByIndex(int nIndex) const
{
	if (m_pDOMNode == NULL)
		return NULL;

	if (m_pDOMNode->GetnodeType() != MSXML2::NODE_ELEMENT)
		return NULL;

	MSXML2::IXMLDOMNodeListPtr pNodeList = m_pDOMNode->GetchildNodes();
	if (pNodeList == NULL)
		return NULL;

	long nListLen = 0;
	pNodeList->get_length(&nListLen);
	if (nIndex <= 0 || nIndex > nListLen)
		return NULL;

	MSXML2::IXMLDOMNodePtr pNode = NULL;
	int nRealIndex = 0;
	int nCount = 0;
	for (int i = 0; i < nListLen; i++) 
	{ 
		pNodeList->get_item(i, &pNode);
		if (pNode->GetnodeType() == MSXML2::NODE_ELEMENT) 
		{
			nCount++;
			if (nCount == nIndex)
			{
				nRealIndex = i;	
				break;
			}
		}
	} 	

	if (nRealIndex < 0 || nRealIndex >= nListLen)
		return NULL;

	pNodeList->get_item(nRealIndex, &pNode);
	if (pNode->GetnodeType() == MSXML2::NODE_ELEMENT) 
	{ 
		CBpXMLNode *pNodeCreated  = new CBpXMLNode();	
		pNodeCreated->m_pDOMNode = pNode;
		return (IBpXMLNode*)pNodeCreated;
	} 

	return NULL;
}
开发者ID:bjliugq,项目名称:SmartDoctor,代码行数:48,代码来源:ImplXMLNode.cpp

示例3: strTempNodeName

// 获取当前结点,指定名称的第index个Element子结点
IBpXMLNode *CBpXMLNode::GetElementChildByName(const wchar_t *szChildNodeName, int nIndex) const
{
	if (m_pDOMNode == NULL || nIndex <= 0)
		return NULL;

	int nCount = nIndex;
	if (m_pDOMNode->GetnodeType() == MSXML2::NODE_ELEMENT) 
	{ 
		MSXML2::IXMLDOMNodeListPtr pNodeList = m_pDOMNode->GetchildNodes(); 
		if (pNodeList == NULL)
			return NULL;
		long nListLen = 0;
		pNodeList->get_length(&nListLen);; 
		int i = 0;
		MSXML2::IXMLDOMNodePtr pNode = NULL;
		for (;;)
		{ 
			pNodeList->get_item(i, &pNode); 
			if (pNode == NULL)
				break;

			if (pNode->GetnodeType() == MSXML2::NODE_ELEMENT) 
			{ 
				BSTR bstrText = NULL;
				m_pDOMNode->get_nodeName(&bstrText);
				CString strTempNodeName(bstrText);
				if (strTempNodeName.CompareNoCase(szChildNodeName))
				{
					nCount--;
					if(nCount == 0)
					{
						CBpXMLNode *pNodeCreated  = new CBpXMLNode();	
						pNodeCreated->m_pDOMNode = pNode;
						return (IBpXMLNode*)pNodeCreated;
					}
				}
			} 
			i++;
			if(i == nListLen)
				break;
		} 
	}
	return NULL;
}
开发者ID:bjliugq,项目名称:SmartDoctor,代码行数:45,代码来源:ImplXMLNode.cpp

示例4: GetElementCount

// 获取当前节点的所有Element子节点个数
int CBpXMLNode::GetElementCount() const
{
	if (m_pDOMNode == NULL)
		return 0;

	long nResult = 0;
	MSXML2::IXMLDOMNodeListPtr pNodeList = m_pDOMNode->GetchildNodes();
	if (pNodeList != NULL)
	{
		MSXML2::IXMLDOMNodePtr pNode = NULL;
		long nListLen = 0;
		pNodeList->get_length(&nListLen);
		for (long i = 0; i < nListLen; i++) 
		{ 
			pNodeList->get_item(i, &pNode);
			if (pNode != NULL && pNode->GetnodeType() == MSXML2::NODE_ELEMENT)
				nResult++;
		} 	
	}

	return (int)nResult;
}
开发者ID:bjliugq,项目名称:SmartDoctor,代码行数:23,代码来源:ImplXMLNode.cpp

示例5: HasElementChildNodes

// 判断当前节点是否存在Element子结点
bool CBpXMLNode::HasElementChildNodes() const
{
	if(m_pDOMNode == NULL)
		return false;
	
	if (m_pDOMNode->GetnodeType() == MSXML2::NODE_ELEMENT) 
	{ 
		MSXML2::IXMLDOMNodeListPtr pNodeList = m_pDOMNode->GetchildNodes(); 
		if (pNodeList == NULL)
			return false;

		long nListLen = 0;
		pNodeList->get_length(&nListLen);
		MSXML2::IXMLDOMNodePtr pNode = NULL;
		for (int i = 0; i < nListLen; i++)
		{
			pNodeList->get_item(i, &pNode);
			if (pNode->GetnodeType() == MSXML2::NODE_ELEMENT)
				return true;			
		}
	}

	return false;
}
开发者ID:bjliugq,项目名称:SmartDoctor,代码行数:25,代码来源:ImplXMLNode.cpp


注:本文中的msxml2::IXMLDOMNodePtr::GetnodeType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。