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


C++ IXMLDOMNode::get_firstChild方法代码示例

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


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

示例1: Parse4CVMKADForChannels

BOOL Parse4CVMKADForChannels(       //return false if file could not be parsed
    const TCHAR*    pszTrgTypeName, //4cwin, 4cosai, ...
    const TCHAR*    pszAutoDeclIni, //full path and file name of AutoDecl.ini
    IO_COMP_TYP**   ppIOCmps        //return, maqy be NULL if no channel def found
)
{
    TCHAR           szBuffer[2*MAX_PATH];
    IXMLDOMNode*    pNode;
    IXMLDOMNode*    pNode2;
    IXMLDOMNodeList*pNList;
    IXMLDOMNodeList*pNList2;

    *ppIOCmps = NULL;

    strcpy(szBuffer, pszAutoDeclIni);

    FC_StringCutFilePart(szBuffer);
    _tcscat(szBuffer, _T("\\"));
    _tcscat(szBuffer, pszTrgTypeName);
    _tcscat(szBuffer, _T("_4cvm.kad"));

    pNode = XMLLoadFile(szBuffer);
    if(!pNode)
        return FALSE;

    pNode2 = NULL;
    pNode->get_firstChild(&pNode2); //assume first child is <TRGTYP EXT="4cwin" USECHANNELNUM="0">
    FC_RELEASE_PTR(pNode)
    if(!pNode2)
        return FALSE;
    
    pNList = NULL;
    pNode2->selectNodes(L"IOCOMPONENTS", &pNList);
    FC_RELEASE_PTR(pNode2)
    if(!pNList)
        return FALSE;

    long len = 0;
    pNList->get_length(&len);
    ATLASSERT(len<=1);
    if(len>0)
    {
        pNList->get_item(0, &pNode);
        // <CHANNEL>
        pNList2 = NULL;
        pNode->selectNodes(L"CHANNEL", &pNList2);
        *ppIOCmps = ReadIOComponents(pNList2);
        FC_RELEASE_PTR(pNList2);
        FC_RELEASE_PTR(pNode);
    }
    FC_RELEASE_PTR(pNList);



    return TRUE;
}
开发者ID:LM25TTD,项目名称:ATCMcontrol_Engineering,代码行数:56,代码来源:util.cpp

示例2: insertFileItem

int DicomImageSet::insertFileItem(IXMLDOMDocument *pDom, IXMLDOMNode * pRoot, const QString &folderName, const QString &fileName)
{
	DicomImage * dicomImage = new DicomImage ();
	if (!dicomImage->readHeader((QDir(folderName).absoluteFilePath(fileName)).toStdString().c_str()))
	{
		//fail to resolve header information
		return 0;
	}
	int nElement;

	char * patientsName = dicomImage->getCharTag(DicomImage::TAG_PATIENTS_NAME, nElement);
	char * patientsId = dicomImage->getCharTag(DicomImage::TAG_PATIENT_ID, nElement);
	char * protocolName = dicomImage->getCharTag(DicomImage::TAG_PROTOCOL_NAME, nElement);
	double * pInstanceNumber = dicomImage->getNumericTag(DicomImage::TAG_INSTANCE_NUMBER, nElement);
	double * pAcquisitionNumber = dicomImage->getNumericTag(DicomImage::TAG_ACQUISITION_NUMBER, nElement);
	double * pAcquisitionDate = dicomImage->getNumericTag(DicomImage::TAG_ACQUISITION_DATE, nElement);
	int instanceNumber = pInstanceNumber?(int)pInstanceNumber[0]:-1;
	int acquisitionNumber = pAcquisitionNumber?(int)pAcquisitionNumber[0]:-1;
	int acquisitionDate = pAcquisitionDate?(int)pAcquisitionDate[0]:0;

	IXMLDOMNode * pParent = findParentNode(pDom, pRoot, patientsName, patientsId, acquisitionDate, protocolName, acquisitionNumber);

	if (!pParent)
	{
		return 0;
	}

	HRESULT hr = S_OK;
    IXMLDOMElement *pNode = NULL;
    CHK_HR(CreateElement(pDom, L"File", &pNode));
	CHK_HR(CreateAndAddAttributeNode(pDom, L"path", fileName.toStdWString().c_str(), pNode));
	CHK_HR(CreateAndAddAttributeNode(pDom, L"instance_number", QString::number(instanceNumber).toStdWString().c_str(), pNode));

	IXMLDOMNode * pSibling = NULL;
	CHK_HR(pParent->get_firstChild(&pSibling));
	int sibInstanceNumber = -1;
	VARIANT varInstanceNumber;
	DOMNodeType nodeType;
	while (pSibling && instanceNumber >= sibInstanceNumber)
	{
		CHK_HR(pSibling->get_nodeType(&nodeType));
		if(nodeType == NODE_ELEMENT)
		{
			CHK_HR(GetAttributeFromNode(pSibling, L"instance_number", &varInstanceNumber));
			sibInstanceNumber = QString::fromWCharArray(_bstr_t(varInstanceNumber)).toInt();
			if (instanceNumber < sibInstanceNumber)
			{
				break;
			}
		}
		IXMLDOMNode * tmpNode = NULL;
		CHK_HR(pSibling->get_nextSibling(&tmpNode));
		SAFE_RELEASE(pSibling);
		pSibling = tmpNode;
	}
	if (pSibling)
	{
		IXMLDOMNode * tmpNode = NULL;
		CHK_HR(pSibling->get_previousSibling(&tmpNode));
		SAFE_RELEASE(pSibling);
		pSibling = tmpNode;
	}
    CHK_HR(CreateAndAddTextNodeBefore(pDom, L"\n", pParent, pSibling));
    CHK_HR(InsertChildToParent(pNode, pSibling, pParent));

CleanUp:
    SAFE_RELEASE(pNode);

	return 1;
}
开发者ID:vcpudding,项目名称:DTI-Visualization,代码行数:70,代码来源:DicomImageSet.cpp

示例3: InitializeFromXmlDoc


//.........这里部分代码省略.........

		// 제목은 버린다.
		for (INT j = 1; j < nIndexLength; ++j)
		{
			VOID* pvTable = AllocNewTable(ppwszSheetList[dwSheetIndex], m_dwCodePage);
			if (!pvTable)
			{
				pIndexNodeList->Release();
				pTextNodeList->Release();
				::SysFreeString(rowXPathFormat);

				return false;
			}

			IXMLDOMNode* pCellNode = NULL;
			IXMLDOMNode* pDataNode = NULL;

			if (FAILED(pIndexNodeList->get_item(j, &pCellNode)))
			{
				pIndexNodeList->Release();
				pTextNodeList->Release();
				DeallocNewTable(pvTable, ppwszSheetList[dwSheetIndex]);
				::SysFreeString(rowXPathFormat);

				return false;
			}

			if (!pCellNode)
			{
				DeallocNewTable(pvTable, ppwszSheetList[dwSheetIndex]);
				break;
			}

			if (FAILED(pCellNode->get_firstChild(&pDataNode)))
			{
				pCellNode->Release();
				pIndexNodeList->Release();
				pTextNodeList->Release();
				DeallocNewTable(pvTable, ppwszSheetList[dwSheetIndex]);
				::SysFreeString(rowXPathFormat);

				return false;
			}

			if (!pDataNode)
			{
				pCellNode->Release();
				DeallocNewTable(pvTable, ppwszSheetList[dwSheetIndex]);
				break;
			}

			if (FAILED(pDataNode->get_text(&bstr)))
			{
				::SysFreeString(bstr);
				pDataNode->Release();
				pCellNode->Release();
				pIndexNodeList->Release();
				pTextNodeList->Release();
				DeallocNewTable(pvTable, ppwszSheetList[dwSheetIndex]);
				::SysFreeString(rowXPathFormat);

				return false;
			}

			SetTableData(pvTable, ppwszSheetList[dwSheetIndex], INDEX, bstr);
开发者ID:ChowZenki,项目名称:dboserver,代码行数:66,代码来源:TextAllTable.cpp

示例4: Save


//.........这里部分代码省略.........
	}

	// Теперь собственно значение
	if (nType != REG_MULTI_SZ)
	{
		_ASSERTE(bsValue != NULL);
		SetAttr(pChild, pAttrs, L"data", bsValue);
		::SysFreeString(bsValue); bsValue = NULL;
	}
	else     // Тут нужно формировать список элементов <list>
	{
		VARIANT_BOOL bHasChild = VARIANT_FALSE;
		DOMNodeType  nodeType = NODE_INVALID;
		// Если ранее был параметр "data" - удалить его из списка атрибутов
		hr = pAttrs->getNamedItem(L"data", &pNode);

		if (SUCCEEDED(hr) && pNode)
		{
			hr = pChild->removeChild(pNode, &pNodeRmv);
			pNode->Release(); pNode = NULL;

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

		//TODO: может оставить перевод строки?
		// Сначала почистим
#ifdef _DEBUG
		hr = pChild->get_nodeType(&nodeType);
#endif
		hr = pChild->hasChildNodes(&bHasChild);

		if (bHasChild)
		{
			while((hr = pChild->get_firstChild(&pNode)) == S_OK && pNode)
			{
				hr = pNode->get_nodeType(&nodeType);
#ifdef _DEBUG
				BSTR bsDebug = NULL;
				pNode->get_text(&bsDebug);

				if (bsDebug) ::SysFreeString(bsDebug); bsDebug = NULL;

#endif
				hr = pChild->removeChild(pNode, &pNodeRmv);

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

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

		// Теперь - добавляем список
		wchar_t* psz = (wchar_t*)value;
		BSTR bsNodeType = ::SysAllocString(L"line");
		VARIANT vtType; vtType.vt = VT_I4; vtType.lVal = NODE_ELEMENT;
		long nAllLen = nSize/2; // длина в wchar_t
		long nLen = 0;

		while(psz && *psz && nAllLen > 0)
		{
			hr = mp_File->createNode(vtType, bsNodeType, L"", &pNode);

			if (FAILED(hr) || !pNode)
				break;

			if (!SetAttr(pNode, L"data", psz))
开发者ID:mirror,项目名称:conemu,代码行数:67,代码来源:Registry.cpp


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