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


C++ IXMLDOMNodeList类代码示例

本文整理汇总了C++中IXMLDOMNodeList的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMNodeList类的具体用法?C++ IXMLDOMNodeList怎么用?C++ IXMLDOMNodeList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: XmlLoad

/** 
* загрузка и парсинг xml документа
* @param data текст загружаемого xml докуммента
* @return TRUE если всё ОК, FALSE в случае ошибки
*/
BOOL XmlLoad(PWSTR lpwcData, IXMLDOMDocument **pXMLDoc, IXMLDOMNode **pIDOMRootNode, PWSTR lpwcRootNodeName)
{
    BOOL bOk = FALSE;
    VARIANT_BOOL status;

    // initialize COM
    HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
    if (FAILED(hr))
    {
        DbgMsg(__FILE__, __LINE__, "CoInitializeEx() ERROR 0x%.8x\n", hr);
        return FALSE;
    }    

    // create new msxml document instance
    hr = CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, 
        IID_IXMLDOMDocument, (void **)pXMLDoc);
    if (FAILED(hr)) 
    {
        DbgMsg(__FILE__, __LINE__, "CoCreateInstance() ERROR 0x%.8x\n", hr);
        return FALSE;
    }    

    hr = (*pXMLDoc)->loadXML(lpwcData, &status);
    if (status != VARIANT_TRUE)
    {
        DbgMsg(__FILE__, __LINE__, "pXMLDoc->load() ERROR 0x%.8x\n", hr);
        goto end;
    }

    // если xml загружен, получаем список корневых узлов
    // из которого получаем главный подузел 'logger'
    IXMLDOMNodeList *pIDOMRootNodeList;
    hr = (*pXMLDoc)->get_childNodes(&pIDOMRootNodeList);
    if (SUCCEEDED(hr))
    {
        *pIDOMRootNode = ConfGetListNodeByName(lpwcRootNodeName, pIDOMRootNodeList);
        if (*pIDOMRootNode)
        {
            bOk = TRUE;
        }            

        pIDOMRootNodeList->Release();        
    }
    else
    {
        DbgMsg(__FILE__, __LINE__, "pXMLDoc->get_childNodes() ERROR 0x%.8x\n", hr);
    }    

end:

    if (!bOk)
    {
        // произошла ошибка
        // освобождаем дескриптор докуммента
        (*pXMLDoc)->Release();
        *pXMLDoc = NULL;
    }

    return bOk;
}
开发者ID:BwRy,项目名称:ioctlfuzzer,代码行数:65,代码来源:xml.cpp

示例2: HasNode

BOOL CKADmerge::HasNode(IXMLDOMNode * pXMLNode, string sPatternString, IXMLDOMNode ** pXMLTarget)
{
    BOOL bRet = FALSE;
    HRESULT hRes = 0;
    LONG lListLength = 0;

    IXMLDOMNodeList * pXMLNodeList = NULL;
    _bstr_t bPatternString(sPatternString.c_str());
    hRes = pXMLNode->selectNodes(bPatternString, &pXMLNodeList);

    if(SUCCEEDED(hRes))
    {
        hRes = pXMLNodeList->get_length(&lListLength);
        if(lListLength)
        {
            hRes = pXMLNodeList->nextNode(pXMLTarget);
            bRet = TRUE;
        }
        else
        {
            string str01 = GetName(pXMLNode);
            string str02 = GetName(*pXMLTarget);
            bRet = FALSE;
        }
    }

    if(pXMLNodeList)
        pXMLNodeList->Release();

    return bRet;
}
开发者ID:LM25TTD,项目名称:ATCMcontrol_Engineering,代码行数:31,代码来源:KADmerge.cpp

示例3: CatalogsParseFromXml

extern "C" HRESULT CatalogsParseFromXml(
    __in BURN_CATALOGS* pCatalogs,
    __in IXMLDOMNode* pixnBundle
    )
{
    HRESULT hr = S_OK;
    IXMLDOMNodeList* pixnNodes = NULL;
    IXMLDOMNode* pixnNode = NULL;
    DWORD cNodes = 0;
    LPWSTR scz = NULL;

    // select catalog nodes
    hr = XmlSelectNodes(pixnBundle, L"Catalog", &pixnNodes);
    ExitOnFailure(hr, "Failed to select catalog nodes.");

    // get catalog node count
    hr = pixnNodes->get_length((long*)&cNodes);
    ExitOnFailure(hr, "Failed to get payload node count.");
    if (!cNodes)
    {
        ExitFunction();
    }

    // allocate memory for catalogs
    pCatalogs->rgCatalogs = (BURN_CATALOG*)MemAlloc(sizeof(BURN_CATALOG) * cNodes, TRUE);
    ExitOnNull(pCatalogs->rgCatalogs, hr, E_OUTOFMEMORY, "Failed to allocate memory for payload structs.");

    pCatalogs->cCatalogs = cNodes;

    // parse catalog elements
    for (DWORD i = 0; i < cNodes; ++i)
    {
        BURN_CATALOG* pCatalog = &pCatalogs->rgCatalogs[i];
        pCatalog->hFile = INVALID_HANDLE_VALUE;

        hr = XmlNextElement(pixnNodes, &pixnNode, NULL);
        ExitOnFailure(hr, "Failed to get next node.");

        // @Id
        hr = XmlGetAttributeEx(pixnNode, L"Id", &pCatalog->sczKey);
        ExitOnFailure(hr, "Failed to get @Id.");

        // @Payload
        hr = XmlGetAttributeEx(pixnNode, L"Payload", &pCatalog->sczPayload);
        ExitOnFailure(hr, "Failed to get @Payload.");

        // prepare next iteration
        ReleaseNullObject(pixnNode);
    }

LExit:
    ReleaseObject(pixnNodes);
    ReleaseObject(pixnNode);
    ReleaseStr(scz);

    return hr;
}
开发者ID:lukaswinzenried,项目名称:WixCustBa,代码行数:57,代码来源:catalog.cpp

示例4: FindElements

// FindElements
UINT COpcXmlDocument::FindElements(const COpcString& cXPath, COpcXmlElementList& cElements)
{
    cElements.RemoveAll();

    // check if document exists.
    if (m_ipDocument == NULL)
    {
        return 0;
    }

    // search for matching nodes.
    IXMLDOMNodeList* ipNodes = NULL;

    BSTR bstrQuery = SysAllocString(cXPath);
    HRESULT hResult = m_ipDocument->selectNodes(bstrQuery, &ipNodes);
    SysFreeString(bstrQuery);

    if (FAILED(hResult))
    {
        return 0;
    }

    // add found nodes to element list.
    do
    {
        IXMLDOMNode* ipNode = NULL;

        hResult = ipNodes->nextNode(&ipNode);

        if (hResult != S_OK || ipNode == NULL)
        {
            break;
        }

        COpcXmlElement cElement(ipNode);
        ipNode->Release();

        if (cElement != NULL)
        {
            cElements.Append(cElement);
        }
    }
    while (SUCCEEDED(hResult));

    if (ipNodes != NULL)
    {
        ipNodes->Release();
    }

    // return the number of elements found.
    return cElements.GetSize();
}
开发者ID:OPCFoundation,项目名称:UA-.NET,代码行数:53,代码来源:COpcXmlDocument.cpp

示例5: ParseWxlControls

static HRESULT ParseWxlControls(
    __in IXMLDOMElement* pElement,
    __in WIX_LOCALIZATION* pWixLoc
    )
{
    HRESULT hr = S_OK;
    IXMLDOMNode* pixn = NULL;
    IXMLDOMNodeList* pixnl = NULL;
    DWORD dwIdx = 0;

    hr = XmlSelectNodes(pElement, L"UI|Control", &pixnl);
    ExitOnLastError(hr, "Failed to get UI child nodes of Wxl File.");

    hr = pixnl->get_length(reinterpret_cast<long*>(&pWixLoc->cLocControls));
    ExitOnLastError(hr, "Failed to get number of UI child nodes in Wxl File.");

    if (0 < pWixLoc->cLocControls)
    {
        pWixLoc->rgLocControls = static_cast<LOC_CONTROL*>(MemAlloc(sizeof(LOC_CONTROL) * pWixLoc->cLocControls, TRUE));
        ExitOnNull(pWixLoc->rgLocControls, hr, E_OUTOFMEMORY, "Failed to allocate memory for localized controls.");

        while (S_OK == (hr = XmlNextElement(pixnl, &pixn, NULL)))
        {
            hr = ParseWxlControl(pixn, dwIdx, pWixLoc);
            ExitOnFailure(hr, "Failed to parse localized control.");

            ++dwIdx;
            ReleaseNullObject(pixn);
        }

        hr = S_OK;
        ExitOnFailure(hr, "Failed to enumerate all localized controls.");
    }

LExit:
    if (FAILED(hr) && pWixLoc->rgLocControls)
    {
        for (DWORD idx = 0; idx < pWixLoc->cLocControls; ++idx)
        {
            ReleaseStr(pWixLoc->rgLocControls[idx].wzControl);
            ReleaseStr(pWixLoc->rgLocControls[idx].wzText);
        }

        ReleaseMem(pWixLoc->rgLocControls);
    }

    ReleaseObject(pixn);
    ReleaseObject(pixnl);

    return hr;
}
开发者ID:925coder,项目名称:wix3,代码行数:51,代码来源:locutil.cpp

示例6: _snprintf

long lvDCOMInterface::nParams()
{
	long n = 0;
	char control_name_xpath[MAX_PATH_LEN];
	_snprintf(control_name_xpath, sizeof(control_name_xpath), "/lvinput/section[@name='%s']/vi/param", m_configSection.c_str());
	IXMLDOMNodeList* pXMLDomNodeList = NULL;
	HRESULT hr = m_pxmldom->selectNodes(_bstr_t(control_name_xpath), &pXMLDomNodeList);
	if (SUCCEEDED(hr) && pXMLDomNodeList != NULL)
	{
		pXMLDomNodeList->get_length(&n);
		pXMLDomNodeList->Release();
	}
	return n;
}
开发者ID:ISISComputingGroup,项目名称:EPICS-lvDCOM,代码行数:14,代码来源:lvDCOMInterface.cpp

示例7: GetRootNode

/*
	Function name	: CXML::GetRootNode
	Description	    : This helper function retrieves the DOM pointer to the root node
	Return type		: bool 
	Argument        : CString csRootTagName
	Tested			: Ok
*/
bool CXML::GetRootNode(CString csRootTagName)
{
	IXMLDOMNodeList * pINodeList = NULL;

	_bstr_t bstrRootTagName(csRootTagName);

	m_hr = m_pXMLDoc->getElementsByTagName(bstrRootTagName ,&pINodeList);

	if(!SUCCEEDED(m_hr))
		return false;

	m_hr = pINodeList->nextNode(&m_pIRootNode);
	pINodeList->Release();
	if(!SUCCEEDED(m_hr))
		return false;

	return true;
}
开发者ID:alexcpn,项目名称:TelephonyIVRKeyMapDemo,代码行数:25,代码来源:XML.cpp

示例8:

IXMLDOMNode *CXML::NextChildNode(IXMLDOMNode **ppNode)
{
	if(!(*ppNode))
		return NULL;

	IXMLDOMNode * pNode = NULL;
	IXMLDOMNodeList * pChildList = NULL;
	
	// Get the list of child nodes of the current node

	m_hr = (*ppNode)->get_childNodes(&pChildList);
	if (!SUCCEEDED(m_hr))
		return NULL;
	// loop through the childs
	DOMNodeType nodeType;
	while(true)
	{
		// Get the node type of each child, if it is of NODE_ELEMENT type set it as current node
		m_hr = pChildList->nextNode(&pNode);
		if(!SUCCEEDED(m_hr))
		{
			pChildList->Release();
			return NULL;
		}
		if(!pNode) break;
		m_hr = pNode->get_nodeType(&nodeType);
		if(!SUCCEEDED(m_hr))
		{
			pChildList->Release();
			pNode->Release();
			return NULL;
		}

		if(nodeType == NODE_ELEMENT)
			break;
		if(pNode)
			pNode->Release();
	}

	if(pChildList)
		pChildList->Release();

	return pNode;
}
开发者ID:alexcpn,项目名称:TelephonyIVRKeyMapDemo,代码行数:44,代码来源:XML.cpp

示例9: getOrderedDcmFiles

QStringList DicomImageSet::getOrderedDcmFiles(const QString &datasetFileName, const QString & queryString)
{
    HRESULT hr = S_OK;
    IXMLDOMDocument *pXMLDom = NULL;
    IXMLDOMNodeList *pFileNodes = NULL;
    VARIANT_BOOL varStatus;
    VARIANT varFileName;
	BSTR bstrQuery;

	QStringList fileList;

    CHK_HR(CreateAndInitDOM(&pXMLDom));

	CHK_HR(VariantFromString(datasetFileName.toStdWString().c_str(), varFileName));
    CHK_HR(pXMLDom->load(varFileName, &varStatus));
    if (varStatus != VARIANT_TRUE)
    {
        CHK_HR(ReportParseError(pXMLDom, "Failed to load DOM from stocks.xml."));
    }

    bstrQuery = SysAllocString(queryString.toStdWString().c_str());
    CHK_ALLOC(bstrQuery);
    CHK_HR(pXMLDom->selectNodes(bstrQuery, &pFileNodes));
	if (pFileNodes)
	{
		long nFiles;
		CHK_HR(pFileNodes->get_length(&nFiles));
		for (long i=0; i<nFiles; ++i)
		{
			VARIANT varValue;
			IXMLDOMNode * pFile = NULL;
			CHK_HR(pFileNodes->get_item(i, &pFile));
			CHK_HR(GetAttributeFromNode(pFile, L"path", &varValue));
			fileList <<QString::fromWCharArray(_bstr_t(varValue));
			SAFE_RELEASE(pFile);
		}
	}

CleanUp:
	SAFE_RELEASE(pXMLDom);
	SAFE_RELEASE(pFileNodes);
	return fileList;
}
开发者ID:vcpudding,项目名称:DTI-Visualization,代码行数:43,代码来源:DicomImageSet.cpp

示例10: GetChildNodes

CXmlNodeList* CXmlNode::GetChildNodes()
{    
    if (NULL == m_pChildNodes && NULL != m_pNode)
    {
        HRESULT hr = S_OK;
        IXMLDOMNodeList* pChildNodes = NULL;

        hr = m_pNode->get_childNodes(&pChildNodes);
        if (SUCCEEDED(hr) && NULL != pChildNodes)
        {
            m_pChildNodes = new CXmlNodeList(pChildNodes);

            pChildNodes->Release();
            pChildNodes = NULL;
        }
    }

    return m_pChildNodes;
}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:19,代码来源:XmlNode.cpp

示例11: GetNoOfChildNodes

/*
	Function name	: CXML::GetNoOfChildNodes
	Description	    :Get the no of childs of the current node 
	Return type		: bool 
	Argument        : long &nNodes
	Tested			: Ok
*/
bool CXML::GetNoOfChildNodes(long &nNodes)
{
	if(!m_pICurrentNode)
		return false;

	IXMLDOMNodeList * pNodeList = NULL;

	m_hr = m_pICurrentNode->get_childNodes(&pNodeList);

	if(!SUCCEEDED(m_hr ) || !pNodeList)
		return false;

	m_hr = pNodeList->get_length(&nNodes);

	if(!SUCCEEDED(m_hr ))
		return false;
	else
		return true;
}
开发者ID:alexcpn,项目名称:TelephonyIVRKeyMapDemo,代码行数:26,代码来源:XML.cpp

示例12:

HRESULT COFSNcDlg2::SelectChildNode(IXMLDOMNode *pNodeParent, BSTR bsSelect, IXMLDOMNode **ppNodeChild, BSTR *pbsNodeText)
{
	HRESULT hr;
	IXMLDOMNodeList *pNodeList = NULL;
	IXMLDOMNode *pNodeChild = NULL;
	
	if(pNodeParent == NULL || (ppNodeChild == NULL && pbsNodeText == NULL))
		return E_INVALIDARG;
	
	if(ppNodeChild != NULL)
		*ppNodeChild = NULL;
	
	DOMNodeType nt;
	hr = pNodeParent->get_nodeType(&nt);
	hr = pNodeParent->selectNodes(bsSelect, &pNodeList);
	if(pNodeList)
	{
		hr = pNodeList->get_item(0, &pNodeChild);
		if(pNodeChild != NULL)
		{
			if(pbsNodeText != NULL)
			{
				BSTR bs;
				hr = pNodeChild->get_text(&bs);
				*pbsNodeText = bs;
			}
			
			if(ppNodeChild == NULL)
			{
				pNodeChild->Release();
				pNodeChild = NULL;
			}
			else
				*ppNodeChild = pNodeChild;
		}
		pNodeList->Release();
		pNodeList = NULL;
	}
	return hr;
}
开发者ID:alex765022,项目名称:IBN,代码行数:40,代码来源:OFSNcDlg2.cpp

示例13: ConfGetNodeByName

/** 
 * получение подузла по его имени
 * @param NodeName имя искомого узла
 * @param pIDOMNode дескриптор родительского узла
 * @return дескриптор нужного узла, или NULL в случае неудачи
 * @see ConfGetListNodeByName()  
 * @see ConfGetNodeText() 
 * @see ConfGetTextByName()
 */
IXMLDOMNode * ConfGetNodeByName(BSTR NodeName, IXMLDOMNode *pIDOMNode)
{
    IXMLDOMNode *pIDOMRetNode = NULL;
    IXMLDOMNodeList *pIDOMNodeList = NULL;

    if (pIDOMNode == NULL)
    {
        return NULL;
    }

    HRESULT hr = pIDOMNode->get_childNodes(&pIDOMNodeList);
    if (SUCCEEDED(hr) && pIDOMNodeList)
    {
        pIDOMRetNode = ConfGetListNodeByName(NodeName, pIDOMNodeList);
        pIDOMNodeList->Release();        
    } 
    else 
    {
        DbgMsg(__FILE__, __LINE__, "pIDOMNodeList->get_length() ERROR 0x%.8x\n", hr);
    }

    return pIDOMRetNode;
} 
开发者ID:BwRy,项目名称:ioctlfuzzer,代码行数:32,代码来源:xml.cpp

示例14: _ASSERT

bool CModelToolCharDataTable::LoadProperty(const char * lpszFullPathFileName)
{
	CNtlXMLDoc doc;
	if(doc.Create() == false)
	{
		_ASSERT(0);
		return false;
	}
	
	if(doc.Load( const_cast<char *>(lpszFullPathFileName) ) == false)
	{
		_ASSERT(0);
		return false;
	}
	
	char szBuffer[1024];

	if( !doc.GetDataWithXPath(const_cast<char *>(XML_PROP_NAME_ATTRIBUTE), szBuffer, sizeof(szBuffer)) )
	{
		_ASSERT(0);
		return false;
	}

	sMODELTOOL_CHAR_TBLDAT	*pModelToolCharData = new sMODELTOOL_CHAR_TBLDAT;

	Add(szBuffer, pModelToolCharData);

	IXMLDOMNodeList *pAnimDataList = doc.SelectNodeList(XML_PROP_ANIM_DATA_ELEMENT);
	IXMLDOMNode* pAnimDataNode = NULL;

	IXMLDOMNodeList *pAnimEventList = NULL;
	IXMLDOMNode* pAnimEventNode = NULL;

	long	lAnimDataNodeNum = 0;
	long	lAnimEventNodeNum = 0;

	int		nAnimKeyID = 0;
	float	fDurationTime = 0.f;

	BYTE	byPushCount = 0;
	BYTE	byKnockDownCount = 0;
    bool    bKB2Push = false;
	BYTE	byHitCount = 0;
	float	aHitTime[NTL_MAX_SIZE_HIT];

	pAnimDataList->get_length(&lAnimDataNodeNum);
	for(long m = 0; m < lAnimDataNodeNum ; ++m)
	{
		pAnimDataList->get_item(m,&pAnimDataNode);

		if(!doc.GetTextWithAttributeName(pAnimDataNode, XML_PROP_ANIM_DATA_ELEMENT_KEYID_ATTRIBUTE, szBuffer, sizeof(szBuffer)))
		{
			_ASSERT(0);
			return false;
		}
		nAnimKeyID = atoi(szBuffer);

		if(!doc.GetTextWithAttributeName(pAnimDataNode, XML_PROP_ANIM_DATA_ELEMENT_PLAYTIME_ATTRIBUTE, szBuffer, sizeof(szBuffer)))
		{
			_ASSERT(0);
			return false;
		}

		fDurationTime = (float)atof(szBuffer);
		
		pAnimDataNode->selectNodes(L"ANIM_EVENT", &pAnimEventList);
		pAnimEventList->get_length(&lAnimEventNodeNum);

		memset(aHitTime, 0, sizeof(aHitTime));
		for(long n = 0; n < lAnimEventNodeNum; ++n)
		{
			pAnimEventList->get_item(n, &pAnimEventNode);

			if(!doc.GetTextWithAttributeName(pAnimEventNode, XML_PROP_ANIM_DATA_ELEMENT_EVENTID_ATTRIBUTE, szBuffer, sizeof(szBuffer)))
			{
				_ASSERT(0);
				return false;
			}
	
			int nAnimEventID = EVENT_ANIM_NONE;
			int nBehavior = TARGET_BEHAVIOR_NONE;

			nAnimEventID = atoi(szBuffer);

			if(nAnimEventID == EVENT_ANIM_HIT)
			{
				if(!doc.GetTextWithAttributeName(pAnimEventNode, XML_PROP_ANIM_DATA_ELEMENT_HITBEHAVIOR_ATTRIBUTE, szBuffer, sizeof(szBuffer)))
				{
					_ASSERT(0);
					return false;
				}
				
				nBehavior = atoi(szBuffer);

				if(nBehavior == TARGET_BEHAVIOR_PUSH)
				{
					byPushCount++;
				}
				else if(nBehavior == TARGET_BEHAVIOR_KNOCK_DOWN)
				{
//.........这里部分代码省略.........
开发者ID:JunRyuu,项目名称:AKCore,代码行数:101,代码来源:ModelToolCharDataTable.cpp

示例15: strPath

bool CModelToolCharDataTable::LoadPropertyList(const char *lpszPath, const char * lpszFileName)
{
	CNtlXMLDoc doc;
	std::string strPath( lpszPath );
	std::string strFileName;
	
	if(doc.Create() == false)
	{
		_ASSERT(0);
		return false;
	}
	
	strFileName = strPath;
	strFileName += "/";
	strFileName += lpszFileName;

	if(doc.Load( const_cast<char *>(strFileName.c_str()) ) == false)
	{
		_ASSERT(0);
		return false;
	}
	
	

	IXMLDOMNodeList *pList = doc.SelectNodeList(XML_PROP_LIST_ELEMENT);
	IXMLDOMNode* pNode = NULL;
	char szBuffer[1024];

	long  lNum;
	pList->get_length(&lNum);
	for(long i = 0; i < lNum ; ++i)
	{
		pList->get_item(i,&pNode);

		if(!doc.GetTextWithAttributeName(pNode, XML_PROP_LIST_ELEMENT_NAME_ATTRIBUTE, szBuffer, sizeof(szBuffer)))
		{
			_ASSERT(0);
			return false;
		}
		strFileName = strPath + "/" + szBuffer;
		
		if( LoadProperty( strFileName.c_str() ) == false )
		{
			_ASSERT(0);
			return false;
		}

		if(pNode)
		{
			pNode->Release(); 
			pNode = NULL;
		}
	}

	if(pList)
	{
		pList->Release(); 
		pList = NULL;
	}

	return true;
}
开发者ID:JunRyuu,项目名称:AKCore,代码行数:62,代码来源:ModelToolCharDataTable.cpp


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