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


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

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


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

示例1: GetAttribute

std::wstring CXmlNode::GetAttribute(LPCTSTR lpAttributeName)
{
	IXMLDOMNamedNodeMap* lpNamedNodeMap;
	IXMLDOMNode* lpXMLNode;
	BSTR bstrValue;
	std::wstring strValue;
	HRESULT hr;

	if (NULL == lpAttributeName || NULL == m_pXMLNode)
		return _T("");

	lpNamedNodeMap = NULL;
	hr = m_pXMLNode->get_attributes(&lpNamedNodeMap);
	if (hr == S_OK)
	{
		lpXMLNode = NULL;
		hr = lpNamedNodeMap->getNamedItem((WCHAR *)lpAttributeName, &lpXMLNode);
		if (hr == S_OK)
		{
			hr = lpXMLNode->get_text(&bstrValue);
			if (hr == S_OK)
			{
				strValue = (WCHAR *)bstrValue;
				::SysFreeString(bstrValue);
			}
			lpXMLNode->Release();
		}
		lpNamedNodeMap->Release();
	}

	return strValue;
}
开发者ID:wyrover,项目名称:IMClient,代码行数:32,代码来源:XmlDocument.cpp

示例2: GetDataWithXPath

bool CNtlXMLDoc::GetDataWithXPath(WCHAR* pwszXPath, WCHAR* pwszResultData, int nBufferSizeInWChars)
{
	if (NULL == pwszXPath || NULL == pwszResultData || 0 >= nBufferSizeInWChars)
		return false;

	IXMLDOMNode* pNode = NULL;    
	m_pXMLDocument->selectSingleNode(pwszXPath, &pNode);

	if(!pNode)
		return false;

	BSTR bstr = NULL;
	if (FAILED(pNode->get_text(&bstr)))
	{
		::SysFreeString(bstr);
		pNode->Release();			
		return false;
	}

	wcscpy_s(pwszResultData, nBufferSizeInWChars, bstr);

	::SysFreeString(bstr);
	pNode->Release();

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

示例3: doXPATH

// return "" if no value at path
std::string lvDCOMInterface::doXPATH(const std::string& xpath)
{
	if (m_pxmldom == NULL)
	{
		throw std::runtime_error("m_pxmldom is NULL");
	}
	epicsGuard<epicsMutex> _lock(m_lock);
	std::map<std::string,std::string>::const_iterator it = m_xpath_map.find(xpath);
	if (it != m_xpath_map.end())
	{
		return it->second;
	}
	IXMLDOMNode *pNode = NULL;
	std::string S_res;
	BSTR bstrValue = NULL;
	HRESULT hr = m_pxmldom->selectSingleNode(_bstr_t(xpath.c_str()), &pNode);
	if (SUCCEEDED(hr) && pNode != NULL)
	{
		hr=pNode->get_text(&bstrValue);
		if (SUCCEEDED(hr))
		{
			S_res = envExpand(CW2CT(bstrValue));
			SysFreeString(bstrValue);
		}
		pNode->Release();
	}
	//	else
	//	{
	//		throw std::runtime_error("doXPATH: cannot find " + xpath);
	//	}
	m_xpath_map[xpath] = S_res;
	return S_res;
}
开发者ID:ISISComputingGroup,项目名称:EPICS-lvDCOM,代码行数:34,代码来源:lvDCOMInterface.cpp

示例4: ASSERT

// base function to obtain text from
// node described by XPATH.
HRESULT
CIhvProfileBase::GetTextFromNode
(
    IN  LPCWSTR         pszQuery,
    OUT BSTR*           pbstrText
)
{
    HRESULT         hr          =   S_OK;
    BSTR            bstrQuery   =   NULL;
    IXMLDOMNode*    pQueryNode  =   NULL;

    ASSERT( pszQuery );
    ASSERT( pbstrText );

    // if node is NULL, return empty string.
    if ( !m_pRootNode )
    {
        hr =
        Wstr2Bstr
        (
            L"",
            pbstrText
        );
        BAIL( );
    }

    hr =
    Wstr2Bstr
    (
        pszQuery,
        &bstrQuery
    );
    BAIL_ON_FAILURE( hr );

    hr = m_pRootNode->selectSingleNode( bstrQuery, &pQueryNode );
    BAIL_ON_FAILURE( hr );

    if (!pQueryNode)
    {
        hr = E_UNEXPECTED;
        BAIL_ON_FAILURE( hr );
    }

    hr = pQueryNode->get_text( pbstrText );
    BAIL_ON_FAILURE( hr );

    if ( !(*pbstrText) )
    {
        hr = E_UNEXPECTED;
        BAIL_ON_FAILURE( hr );
    }

error:
    RELEASE_INTERFACE( pQueryNode );
    SYS_FREE_STRING( bstrQuery );
    return hr;
}
开发者ID:0xhack,项目名称:Windows-driver-samples,代码行数:59,代码来源:profile.cpp

示例5: doXPATHbool

bool lvDCOMInterface::doXPATHbool(const std::string& xpath)
{
	if (m_pxmldom == NULL)
	{
		throw std::runtime_error("m_pxmldom is NULL");
	}
	epicsGuard<epicsMutex> _lock(m_lock);
	std::map<std::string,bool>::const_iterator it = m_xpath_bool_map.find(xpath);
	if (it != m_xpath_bool_map.end())
	{
		return it->second;
	}
	IXMLDOMNode *pNode = NULL;
	bool res = false;
	BSTR bstrValue = NULL;
	std::string bool_str;
	HRESULT hr = m_pxmldom->selectSingleNode(_bstr_t(xpath.c_str()), &pNode);
	if (SUCCEEDED(hr) && pNode != NULL)
	{
		hr=pNode->get_text(&bstrValue);
		if (SUCCEEDED(hr))
		{
			bool_str = envExpand(CW2CT(bstrValue));
			if (bool_str.size() == 0)
			{
				res = false;
			}
			// allow true / yes / non_zero_number
			// note: atol() returns 0 for non numeric strings, so OK in a test for "true"
			else if ( (bool_str[0] == 't') || (bool_str[0] == 'T') || (bool_str[0] == 'y') || (bool_str[0] == 'Y') || (atol(bool_str.c_str()) != 0) )
			{
				res = true;
			}
			else
			{
				res = false;
			}
			SysFreeString(bstrValue);
		}
		pNode->Release();
	}
	//	else
	//	{
	//		throw std::runtime_error("doXPATHbool: cannot find " + xpath);
	//	}
	m_xpath_bool_map[xpath] = res;
	return res;
}
开发者ID:ISISComputingGroup,项目名称:EPICS-lvDCOM,代码行数:48,代码来源:lvDCOMInterface.cpp

示例6: GetAttr

BSTR SettingsXML::GetAttr(IXMLDOMNode* apNode, IXMLDOMNamedNodeMap* apAttrs, const wchar_t* asName)
{
	HRESULT hr = S_OK;
	IXMLDOMNode *pValue = NULL;
	BSTR bsText = NULL;
	bsText = ::SysAllocString(asName);
	hr = apAttrs->getNamedItem(bsText, &pValue);
	::SysFreeString(bsText); bsText = NULL;

	if (SUCCEEDED(hr) && pValue)
	{
		hr = pValue->get_text(&bsText);
		pValue->Release(); pValue = NULL;
	}

	return bsText;
}
开发者ID:huyiice,项目名称:ConEmu,代码行数:17,代码来源:Registry.cpp

示例7: GetNodeText

/*
	 Function name		: CXML::GetNodeText
	 Description	    : This function will give node text.
						: searching for the node starts either from the current node
						: or it may start from the Root Node depending on the value of 
						: bool bCurrentNodeAsBase .
	 Return type		: bool 
	 Argument			: CString csPathToNode
	 Argument			: CString &rcsValue
	 Tested				: Ok
 */	
bool CXML::GetNodeText(CString csPathToNode,CString &rcsValue,bool bCurrentNodeAsBase )
{	

	IXMLDOMNode *pINodeData = NULL;
	
	if(!GetNode(&pINodeData,csPathToNode,NULL,NULL,bCurrentNodeAsBase))
		return false;

	BSTR bstrNodeText;

	m_hr = pINodeData->get_text(&bstrNodeText);
	pINodeData->Release();
	if (!SUCCEEDED(m_hr) || !bstrNodeText)
		return false;

	rcsValue = bstrNodeText;
	
	SysFreeString(bstrNodeText);
	return true;
}
开发者ID:alexcpn,项目名称:TelephonyIVRKeyMapDemo,代码行数:31,代码来源:XML.cpp

示例8:

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

示例9: FAILED

bool CDirect3D::SetShaderHLSL(const TCHAR *file)
{
	//MUDLORD: the guts
	//Compiles a shader from files on disc
	//Sets LUT textures to texture files in PNG format.

	TCHAR folder[MAX_PATH];
	TCHAR rubyLUTfileName[MAX_PATH];
	TCHAR *slash;
	char *shaderText = NULL;

	TCHAR errorMsg[MAX_PATH + 50];

	IXMLDOMDocument * pXMLDoc = NULL;
	IXMLDOMElement * pXDE = NULL;
	IXMLDOMNode * pXDN = NULL;
	BSTR queryString, nodeContent;

	HRESULT hr;

	shaderTimer = 1.0f;
	shaderTimeStart = 0;
	shaderTimeElapsed = 0;

	if(effect) {
		effect->Release();
		effect = NULL;
	}
	for(int i = 0; i < MAX_SHADER_TEXTURES; i++) {
		if (rubyLUT[i] != NULL) {
			rubyLUT[i]->Release();
			rubyLUT[i] = NULL;
		}
	}
	if (file == NULL || *file==TEXT('\0'))
		return true;

	hr = CoCreateInstance(CLSID_DOMDocument,NULL,CLSCTX_INPROC_SERVER,IID_PPV_ARGS(&pXMLDoc));

	if(FAILED(hr)) {
		MessageBox(NULL, TEXT("Error creating XML Parser"), TEXT("Shader Loading Error"),
			MB_OK|MB_ICONEXCLAMATION);
		return false;
	}

	VARIANT fileName;
	VARIANT_BOOL ret;
	fileName.vt = VT_BSTR;
#ifdef UNICODE
	fileName.bstrVal = SysAllocString(file);
#else
	wchar_t tempfilename[MAX_PATH];
	MultiByteToWideChar(CP_UTF8,0,file,-1,tempfilename,MAX_PATH);
	fileName.bstrVal = SysAllocString(tempfilename);
#endif
	hr = pXMLDoc->load(fileName,&ret);
	SysFreeString(fileName.bstrVal);

	if(FAILED(hr) || hr==S_FALSE) {
		_stprintf(errorMsg,TEXT("Error loading HLSL shader file:\n%s"),file);
		MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"), MB_OK|MB_ICONEXCLAMATION);
		pXMLDoc->Release();
		return false;
	}

	VARIANT attributeValue;
	BSTR attributeName;

	hr = pXMLDoc->get_documentElement(&pXDE);
	if(FAILED(hr) || hr==S_FALSE) {
		_stprintf(errorMsg,TEXT("Error loading root element from file:\n%s"),file);
		MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"), MB_OK|MB_ICONEXCLAMATION);
		pXMLDoc->Release();
		return false;
	}

	attributeName=SysAllocString(L"language");
	pXDE->getAttribute(attributeName,&attributeValue);
	SysFreeString(attributeName);
	pXDE->Release();

	if(attributeValue.vt!=VT_BSTR || lstrcmpiW(attributeValue.bstrVal,L"hlsl")) {
		_stprintf(errorMsg,TEXT("Shader language is <%s>, expected <HLSL> in file:\n%s"),attributeValue.bstrVal,file);
		MessageBox(NULL, errorMsg, TEXT("Shader Loading Error"), MB_OK|MB_ICONEXCLAMATION);
		if(attributeValue.vt==VT_BSTR) SysFreeString(attributeValue.bstrVal);
		pXMLDoc->Release();
		return false;
	}
	if(attributeValue.vt==VT_BSTR) SysFreeString(attributeValue.bstrVal);

	queryString=SysAllocString(L"/shader/source");
	hr = pXMLDoc->selectSingleNode(queryString,&pXDN);
	SysFreeString(queryString);

	if(hr == S_OK) {
		hr = pXDN->get_text(&nodeContent);
		if(hr == S_OK) {
			int requiredChars = WideCharToMultiByte(CP_ACP,0,nodeContent,-1,shaderText,0,NULL,NULL);
			shaderText = new char[requiredChars];
			WideCharToMultiByte(CP_UTF8,0,nodeContent,-1,shaderText,requiredChars,NULL,NULL);
//.........这里部分代码省略.........
开发者ID:LuigiBlood,项目名称:snes9x-sx2,代码行数:101,代码来源:CDirect3D.cpp

示例10: LoadDialogStatesFromXML

void Explorerplusplus::LoadDialogStatesFromXML(IXMLDOMDocument *pXMLDom)
{
	IXMLDOMNodeList		*pNodes = NULL;
	IXMLDOMNode			*pNode = NULL;
	IXMLDOMNamedNodeMap	*am = NULL;
	IXMLDOMNode			*pChildNode = NULL;
	BSTR						bstrName;
	BSTR						bstrValue;
	BSTR						bstr = NULL;
	HRESULT						hr;
	long						length;
	long						lChildNodes;

	if(pXMLDom == NULL)
		goto clean;

	TCHAR tempNodeSelector[64];
	StringCchPrintf(tempNodeSelector, SIZEOF_ARRAY(tempNodeSelector),
		_T("//%s/*"), DIALOGS_XML_KEY);
	bstr = SysAllocString(tempNodeSelector);
	pXMLDom->selectNodes(bstr,&pNodes);

	if(!pNodes)
	{
		goto clean;
	}
	else
	{
		pNodes->get_length(&length);

		for(long i = 0;i < length;i++)
		{
			/* This should never fail, as the number
			of nodes has already been counted (so
			they must exist). */
			hr = pNodes->get_item(i,&pNode);

			if(SUCCEEDED(hr))
			{
				hr = pNode->get_attributes(&am);

				if(SUCCEEDED(hr))
				{
					/* Retrieve the total number of attributes
					attached to this node. */
					am->get_length(&lChildNodes);

					if(lChildNodes >= 1)
					{
						am->get_item(0,&pChildNode);

						pChildNode->get_nodeName(&bstrName);
						pChildNode->get_text(&bstrValue);

						for(CDialogSettings *ds : DIALOG_SETTINGS)
						{
							TCHAR settingsKey[64];
							bool success = ds->GetSettingsKey(settingsKey, SIZEOF_ARRAY(settingsKey));
							assert(success);

							if(!success)
							{
								continue;
							}

							if(lstrcmpi(bstrValue, settingsKey) == 0)
							{
								ds->LoadXMLSettings(am, lChildNodes);
							}
						}
					}
				}
			}

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

clean:
	if (bstr) SysFreeString(bstr);
	if (pNodes) pNodes->Release();
	if (pNode) pNode->Release();
}
开发者ID:derceg,项目名称:explorerplusplus,代码行数:84,代码来源:DialogHelper.cpp

示例11: InitializeFromXmlDoc


//.........这里部分代码省略.........
			{
				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);

			::SysFreeString(bstr);
			pCellNode->Release();
			pDataNode->Release();

			pCellNode = NULL;
			pDataNode = NULL;

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

				return false;
			}

			if (!pCellNode)
开发者ID:ChowZenki,项目名称:dboserver,代码行数:67,代码来源:TextAllTable.cpp

示例12: OnLoadCatalog

LRESULT CAddVideoHtmlDlg::OnLoadCatalog(WPARAM wParam, LPARAM lParam)
{
	if(wParam == NULL)
	{
		MessageBox(TEXT("获取视频分类数据失败,请检查您的网络情况。"), TEXT("错误"), MB_OK|MB_ICONERROR);
		return 0;
	}

	try
	{
		TSTLSTRING strCatalogHtml;
		int iSelectedIndex = -1;

		IXMLDOMDocument* pDOM = NULL;
		HRESULT hr = CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument, (void**)&pDOM);
		if(hr != S_OK)
		{
			throw Exception(TEXT("解析视频分类数据失败。"));
		}

		VARIANT_BOOL loaded = VARIANT_FALSE;
		hr = pDOM->loadXML(CComBSTR((LPCOLESTR)wParam), &loaded);
		if(hr != S_OK || loaded == VARIANT_FALSE)
		{
			pDOM->Release();
			throw Exception(TEXT("解析视频分类数据失败。"));
		}

		IXMLDOMNodeList* pNodeList = NULL;
		hr = pDOM->get_childNodes(&pNodeList);
		if(hr != S_OK)
		{
			pDOM->Release();
			throw Exception(TEXT("解析视频分类数据失败。"));
		}

		IXMLDOMNode* pRoot = NULL;
		hr = pNodeList->get_item(1, &pRoot);
		if(hr != S_OK)
		{
			pNodeList->Release();
			pDOM->Release();
			throw Exception(TEXT("解析视频分类数据失败。"));
		}

		IXMLDOMNodeList* pRootChildren = NULL;
		hr = pRoot->get_childNodes(&pRootChildren);
		if(hr != S_OK)
		{
			pRoot->Release();
			pNodeList->Release();
			pDOM->Release();
			throw Exception(TEXT("解析视频分类数据失败。"));
		}

		IXMLDOMNode* pResultNote = NULL;
		hr = pRootChildren->get_item(0, &pResultNote);
		if(hr != S_OK)
		{
			pRootChildren->Release();
			pRoot->Release();
			pNodeList->Release();
			pDOM->Release();
			throw Exception(TEXT("解析视频分类数据失败。"));
		}

		IXMLDOMNodeList* pResultChildren = NULL;
		hr = pResultNote->get_childNodes(&pResultChildren);
		if(hr != S_OK)
		{
			pResultNote->Release();
			pRootChildren->Release();
			pRoot->Release();
			pNodeList->Release();
			pDOM->Release();
			throw Exception(TEXT("解析视频分类数据失败。"));
		}

		IXMLDOMNode* pResultStatusNote = NULL;
		hr = pRootChildren->get_item(0, &pResultStatusNote);
		if(hr != S_OK)
		{
			pResultChildren->Release();
			pResultNote->Release();
			pRootChildren->Release();
			pRoot->Release();
			pNodeList->Release();
			pDOM->Release();
			throw Exception(TEXT("解析视频分类数据失败。"));
		}

		CComBSTR bstrResultStatus;
		hr = pResultStatusNote->get_text(&bstrResultStatus);
		if(hr != S_OK)
		{
			pResultStatusNote->Release();
			pResultChildren->Release();
			pResultNote->Release();
			pRootChildren->Release();
			pRoot->Release();
//.........这里部分代码省略.........
开发者ID:NickeyWoo,项目名称:EditorAssistant,代码行数:101,代码来源:AddVideoHtmlDlg.cpp

示例13: SetAttr

bool SettingsXML::SetAttr(IXMLDOMNode* apNode, IXMLDOMNamedNodeMap* apAttrs, const wchar_t* asName, const wchar_t* asValue)
{
	bool lbRc = false;
	HRESULT hr = S_OK;
	IXMLDOMNode *pValue = NULL;
	IXMLDOMAttribute *pIXMLDOMAttribute = NULL;
	BSTR bsText = NULL;
	BSTR bsCurValue = NULL;
	bsText = ::SysAllocString(asName);
	hr = apAttrs->getNamedItem(bsText, &pValue);

	BSTR bsValue = ::SysAllocString(asValue);
	wchar_t* pszEsc = wcschr(bsValue, (wchar_t)27);
	if (pszEsc != NULL)
	{
		_ASSERTE(wcschr(bsValue, (wchar_t)27) == NULL); // У DOM сносит крышу, если писать "ESC" в значение
		while ((pszEsc = wcschr(bsValue, (wchar_t)27)) != NULL)
		{
			*pszEsc = L'?';
		}
	}

	if (FAILED(hr) || !pValue)
	{
		hr = mp_File->createAttribute(bsText, &pIXMLDOMAttribute);
		_ASSERTE(hr == S_OK);

		if (SUCCEEDED(hr) && pIXMLDOMAttribute)
		{
			VARIANT vtValue; vtValue.vt = VT_BSTR; vtValue.bstrVal = bsValue;
			hr = pIXMLDOMAttribute->put_nodeValue(vtValue);
			_ASSERTE(hr == S_OK);
			hr = apAttrs->setNamedItem(pIXMLDOMAttribute, &pValue); //-V519
			_ASSERTE(hr == S_OK);
			lbRc = SUCCEEDED(hr);
			SetDataChanged();
		}
	}
	else if (SUCCEEDED(hr) && pValue)
	{
		// Для проверки mb_DataChanged
		hr = pValue->get_text(&bsCurValue);
		if (SUCCEEDED(hr) && bsCurValue && bsValue
			&& (wcscmp(bsValue, bsCurValue) == 0))
		{
			// Not changed
			lbRc = true;
		}
		else
		{
			// Change the value
			hr = pValue->put_text(bsValue);
			_ASSERTE(hr == S_OK);
			lbRc = SUCCEEDED(hr);
			SetDataChanged();
		}
	}

	::SysFreeString(bsText); bsText = NULL;
	::SysFreeString(bsValue); bsValue = NULL;
	if (bsCurValue) { ::SysFreeString(bsCurValue); bsCurValue = NULL; }

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

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

	return lbRc;
}
开发者ID:huyiice,项目名称:ConEmu,代码行数:68,代码来源:Registry.cpp

示例14: FindItem


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

		pList->Release();
		//pList = NULL; -- для отладки
	}

	if (lbEmpty && abAllowCreate && (asType[0] == L'k'))
	{
		bsText = ::SysAllocString(L"value");
		hr = apFrom->selectNodes(bsText, &pList);
		::SysFreeString(bsText); bsText = NULL;
		if (SUCCEEDED(hr) && pList)
		{
			hr = pList->reset();
			if ((hr = pList->nextNode(&pIXMLDOMNode)) == S_OK && pIXMLDOMNode)
			{
				lbEmpty = FALSE;
				pIXMLDOMNode->Release(); pIXMLDOMNode = NULL;
			}
			pList->Release();
			//pList = NULL; -- для отладки
		}
	}

	if (!pChild && abAllowCreate)
	{
		if (asType[0] == L'k')
		{
			hr = apFrom->get_lastChild(&pChild);
			if (SUCCEEDED(hr) && pChild)
			{
				hr = pChild->get_nodeType(&nodeTypeCheck);
				if (SUCCEEDED(hr) && (nodeTypeCheck == NODE_TEXT))
				{
					hr = pChild->get_text(&bsCheck);
					if (SUCCEEDED(hr) && bsCheck)
					{
						iLastIndent = 0;
						LPCWSTR pszTabs = bsCheck;
						while (*pszTabs)
						{
							if (*(pszTabs++) == L'\t')
								iLastIndent++;
						}
						::SysFreeString(bsCheck); bsCheck = NULL;
					}
				}
			}
			SafeRelease(pChild);
		}

		VARIANT vtType; vtType.vt = VT_I4;
		vtType.lVal = NODE_ELEMENT;
		bsText = ::SysAllocString(asType);
		hr = mp_File->createNode(vtType, bsText, L"", &pChild);
		::SysFreeString(bsText); bsText = NULL;

		if (SUCCEEDED(hr) && pChild)
		{
			if (SetAttr(pChild, L"name", asName))
			{
				if (asType[0] == L'k')
				{
					AppendNewLine(pChild);
					mb_KeyEmpty = true;
					TouchKey(pChild);
				}
开发者ID:huyiice,项目名称:ConEmu,代码行数:67,代码来源:Registry.cpp

示例15: SetModified

HRESULT
CIhvProfileBase::PutTextInNode
(
    IN  LPCWSTR         pszQuery,
    IN  BSTR            bstrText
)
{
    HRESULT         hr          =   S_OK;
    BSTR            bstrQuery   =   NULL;
    BSTR            bstrOrig    =   NULL;
    BOOL            bPut        =   TRUE;
    IXMLDOMNode*    pQueryNode  =   NULL;

    if ( !m_pRootNode )
    {
        hr = E_UNEXPECTED;
        BAIL_ON_FAILURE( hr );
    }

    if ( (!pszQuery) || (!bstrText) )
    {
        hr = E_INVALIDARG;
        BAIL_ON_FAILURE( hr );
    }

    hr =
    Wstr2Bstr
    (
        pszQuery,
        &bstrQuery
    );
    BAIL_ON_FAILURE( hr );

    hr = m_pRootNode->selectSingleNode( bstrQuery, &pQueryNode );
    BAIL_ON_FAILURE( hr );

    if (!pQueryNode)
    {
        hr = E_UNEXPECTED;
        BAIL_ON_FAILURE( hr );
    }

    hr = pQueryNode->get_text( &bstrOrig );
    BAIL_ON_FAILURE( hr );

    if ( bstrOrig && ( 0 == wcscmp( bstrOrig, bstrText ) ) )
    {
        bPut = FALSE;
    }

    if ( bPut )
    {
        hr = pQueryNode->put_text( bstrText );
        BAIL_ON_FAILURE( hr );

        SetModified( );
    }

error:
    RELEASE_INTERFACE( pQueryNode );
    SYS_FREE_STRING( bstrQuery );
    SYS_FREE_STRING( bstrOrig  );
    return hr;
}
开发者ID:340211173,项目名称:Windows-driver-samples,代码行数:64,代码来源:IHVSampleProfile.cpp


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