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


C++ IXMLDOMDocument::Release方法代码示例

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


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

示例1: DomFromCOM

// Helper function to create a DOM instance: 
IXMLDOMDocument * DomFromCOM()
{
   HRESULT hr;
   IXMLDOMDocument *pxmldoc = NULL;

    HRCALL( CoCreateInstance(__uuidof(DOMDocument40),
                      NULL,
                      CLSCTX_INPROC_SERVER,
                      __uuidof(IXMLDOMDocument),
                      (void**)&pxmldoc),
            "Create a new DOMDocument");

    HRCALL( pxmldoc->put_async(VARIANT_FALSE),
            "should never fail");
    HRCALL( pxmldoc->put_validateOnParse(VARIANT_FALSE),
            "should never fail");
    HRCALL( pxmldoc->put_resolveExternals(VARIANT_FALSE),
            "should never fail");

   return pxmldoc;
clean:
   if (pxmldoc)
    {
      pxmldoc->Release();
    }
   return NULL;
}
开发者ID:chutinhha,项目名称:cams,代码行数:28,代码来源:QueryNodes.cpp

示例2: SetIndent

/**
* XML 파일의 형태를 Tab을 이용해서 보기 좋게 정렬한다.
* \param szIndentFileName 정렬에 사용할 스타일 시트 파일명
* return 성공 유무
*/
bool CNtlXMLDoc::SetIndent(WCHAR* szIndentFileName)
{
	IXMLDOMDocument* pXSL = NULL;
	CoCreateInstance(__uuidof(DOMDocument30), NULL, CLSCTX_INPROC_SERVER, __uuidof(IXMLDOMDocument), (void**)&pXSL);
	if(!pXSL)
		return false;

	VARIANT_BOOL vBool;
	pXSL->put_async(VARIANT_FALSE);
	pXSL->load((_variant_t)szIndentFileName, &vBool);

	VARIANT vObject;
	VariantInit(&vObject);
	vObject.vt = VT_DISPATCH;
	vObject.pdispVal = m_pXMLDocument;

	m_pXMLDocument->transformNodeToObject(pXSL, vObject);

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

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

示例3: IsXmlAllowed

bool SettingsXML::IsXmlAllowed()
{
	IXMLDOMDocument* pFile = CreateDomDocument();
	if (pFile)
		pFile->Release();
	return (pFile != NULL);
}
开发者ID:huyiice,项目名称:ConEmu,代码行数:7,代码来源:Registry.cpp

示例4: if

IXMLDOMDocument *XmlParser::_openFile(const LPWSTR file, XMLERRORDATA *error)
{
  if(error)
  {
    error->errorCode = -1;
    error->line      = -1;
    error->reason    = NULL;
  }

  bool ok = false;
  IXMLDOMDocument *x = createAndConfigureInterface();
  if(x)
  {
    VARIANT_BOOL bl;
    VARIANT str;

    //Выделяем строку.
    CWA(oleaut32, VariantInit)(&str);
    str.vt      = VT_BSTR;
    str.bstrVal = CWA(oleaut32, SysAllocString)(file);

    if(str.bstrVal != NULL)
    {
      //Загружаем файл.
      if(x->load(str, &bl) == S_OK && bl == VARIANT_TRUE)ok = true;
      //Получаем ошибку.
      else if(error)
      {
        IXMLDOMParseError *ierror;
        if(x->get_parseError(&ierror) == S_OK)
        {
          long l;
          BSTR reason = NULL;

          //Заполняем структуру.
          if(ierror->get_errorCode(&l) == S_OK)error->errorCode = l;
          if(ierror->get_line(&l) == S_OK)error->line = l;
          if(ierror->get_reason(&reason) == S_OK)error->reason = reason;

          ierror->Release();
        }
      }
      CWA(oleaut32, VariantClear)(&str);
    }

    //Объект не создан, освобождаем интерфейс.
    if(ok == false)
    {
      x->Release();
      x = NULL;
    }
  }
  return x;
}
开发者ID:0x00dec0de,项目名称:Zeus,代码行数:54,代码来源:xmlparser.cpp

示例5: do_CheckXML

int do_CheckXML(lua_State* L)
{
	CString strXml = luaL_checkstring(L,1);

	HRESULT hr;
	IXMLDOMDocument * pXMLDoc;
	//...
	hr = CoInitialize(NULL); 
	// Check the return value, hr...
	hr = CoCreateInstance(CLSID_DOMDocument30, NULL, CLSCTX_INPROC_SERVER, 
		   IID_IXMLDOMDocument, (void**)&pXMLDoc);
	// Check the return value, hr...
	VARIANT_BOOL bSuccessful;
	pXMLDoc->loadXML(strXml.AllocSysString(),&bSuccessful);
	int irez = 0;
	if(!bSuccessful)
	{
		IXMLDOMParseError *pIParseError = NULL;
		pXMLDoc->get_parseError(&pIParseError);

		long lineNum;
		pIParseError->get_line(&lineNum);
		
		long linePos;
		pIParseError->get_linepos(&linePos);

		BSTR reason;
		pIParseError->get_reason(&reason);

		lua_pushinteger(L, lineNum);
		lua_pushinteger(L, linePos);
		lua_pushstring(L, CString(reason));

		pIParseError->Release();
		pIParseError = NULL;
		irez = 3;

	}
	pXMLDoc->Release();

	return irez;
}
开发者ID:mwoz,项目名称:Hildim.Source,代码行数:42,代码来源:mblua.cpp

示例6: SetShadersGLSL

bool COpenGL::SetShadersGLSL(const TCHAR *glslFileName)
{
	char *fragment=NULL, *vertex=NULL;
	IXMLDOMDocument * pXMLDoc = NULL;
	IXMLDOMElement * pXDE = NULL;
	IXMLDOMNode * pXDN = NULL;
	HRESULT hr;
	BSTR queryString, nodeContent;

	TCHAR errorMsg[MAX_PATH + 50];

	if(fragmentShader) {
		glDetachShader(shaderProgram,fragmentShader);
		glDeleteShader(fragmentShader);
		fragmentShader = 0;
	}
	if(vertexShader) {
		glDetachShader(shaderProgram,vertexShader);
		glDeleteShader(vertexShader);
		vertexShader = 0;
	}
	if(shaderProgram) {
		glUseProgram(0);
		glDeleteProgram(shaderProgram);
		shaderProgram = 0;
	}

	if(glslFileName==NULL || *glslFileName==TEXT('\0'))
		return true;

	if(!LoadShaderFunctions()) {
        MessageBox(NULL, TEXT("Unable to load OpenGL shader functions"), TEXT("Shader Loading Error"),
			MB_OK|MB_ICONEXCLAMATION);
        return false;
    }

	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(glslFileName);
#else
	wchar_t tempfilename[MAX_PATH];
	MultiByteToWideChar(CP_UTF8,0,glslFileName,-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 GLSL shader file:\n%s"),glslFileName);
		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"),glslFileName);
		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"glsl")) {
		_stprintf(errorMsg,TEXT("Shader language is <%s>, expected <GLSL> in file:\n%s"),attributeValue.bstrVal,glslFileName);
		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/fragment");
	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,fragment,0,NULL,NULL);
			fragment = new char[requiredChars];
			WideCharToMultiByte(CP_UTF8,0,nodeContent,-1,fragment,requiredChars,NULL,NULL);
		}
//.........这里部分代码省略.........
开发者ID:chuckries,项目名称:snes9x,代码行数:101,代码来源:COpenGL.cpp

示例7: put_RecognitionParam

STDMETHODIMP CStrokeRecognition::put_RecognitionParam(BSTR newVal)
{
	double		Segment_Error_Threshold;
	double		Arc_Error_Threshold;
	double		Arc_Min_Length;
	double		Arc_Min_Curve;
	double		Stroke_Min_Length;
	double		Min_Turning_Angle;
	double		Segmentation_Penalty;
	VARIANT		value;
	BSTR		nodeName;
	long		n;

	IXMLDOMDocument*		pDoc;
	IXMLDOMNodeList*		pNodeList;
	IXMLDOMNode*			pNode;
	IXMLDOMNode*			pParamNode;
	IXMLDOMNode*			pAttrNode;
	IXMLDOMNamedNodeMap*	pNodeMap;
	VARIANT_BOOL			bLoaded;

	GetFittingParam(Segment_Error_Threshold, Arc_Error_Threshold, Arc_Min_Length, Arc_Min_Curve, Stroke_Min_Length, Min_Turning_Angle, Segmentation_Penalty);

	if (SUCCEEDED(CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument, (LPVOID*)&pDoc)))
	{
		pDoc->put_async(VARIANT_FALSE);
		pDoc->loadXML(newVal, &bLoaded);

		if (bLoaded == VARIANT_TRUE)
		{
			if (SUCCEEDED(pDoc->get_childNodes(&pNodeList)))
			{
				pParamNode = NULL;

				pNodeList->get_length(&n);

				for (int i = 0; i < n; i++)
				{
					if (SUCCEEDED(pNodeList->get_item(i, &pNode)))
					{
						nodeName = NULL;
						if (SUCCEEDED(pNode->get_nodeName(&nodeName)))
						{
							if (CComBSTR(nodeName) == L"param")
							{
								pParamNode = pNode;
								pParamNode->AddRef();
								break;
							}
							SysFreeString(nodeName);
						}
						pNode->Release();
					}
				}

				pNodeList->Release();

				if (pParamNode != NULL)
				{
					if (SUCCEEDED(pParamNode->get_attributes(&pNodeMap)))
					{
						if (SUCCEEDED(pNodeMap->getNamedItem(L"Segment_Error_Threshold", &pAttrNode)))
						{
							pAttrNode->get_nodeValue(&value);
							Segment_Error_Threshold = _wtof(value.bstrVal);
							pAttrNode->Release();
						}
						if (SUCCEEDED(pNodeMap->getNamedItem(L"Arc_Error_Threshold", &pAttrNode)))
						{
							pAttrNode->get_nodeValue(&value);
							Arc_Error_Threshold = _wtof(value.bstrVal);
							pAttrNode->Release();
						}
						if (SUCCEEDED(pNodeMap->getNamedItem(L"Arc_Min_Length", &pAttrNode)))
						{
							pAttrNode->get_nodeValue(&value);
							Arc_Min_Length = _wtof(value.bstrVal);
							pAttrNode->Release();
						}
						if (SUCCEEDED(pNodeMap->getNamedItem(L"Arc_Min_Curve", &pAttrNode)))
						{
							pAttrNode->get_nodeValue(&value);
							Arc_Min_Curve = _wtof(value.bstrVal);
							pAttrNode->Release();
						}
						if (SUCCEEDED(pNodeMap->getNamedItem(L"Stroke_Min_Length", &pAttrNode)))
						{
							pAttrNode->get_nodeValue(&value);
							Stroke_Min_Length = _wtof(value.bstrVal);
							pAttrNode->Release();
						}
						if (SUCCEEDED(pNodeMap->getNamedItem(L"Min_Turning_Angle", &pAttrNode)))
						{
							pAttrNode->get_nodeValue(&value);
							Min_Turning_Angle = _wtof(value.bstrVal);
							pAttrNode->Release();
						}
						if (SUCCEEDED(pNodeMap->getNamedItem(L"Segmentation_Penalty", &pAttrNode)))
						{
							pAttrNode->get_nodeValue(&value);
//.........这里部分代码省略.........
开发者ID:sanyaade-g2g-repos,项目名称:quickdiagram,代码行数:101,代码来源:StrokeRecognition.cpp

示例8: DecodePointFromXML

void CStrokeRecognition::DecodePointFromXML(std::vector<POINT> &rgPoints, BSTR strXML)
{
	IXMLDOMDocument*		pDoc;
	IXMLDOMNodeList*		pNodeList;
	IXMLDOMNode*			pNode;
	IXMLDOMNode*			pInputNode;
	IXMLDOMNode*			pAttrNode;
	IXMLDOMNamedNodeMap*	pNodeMap;
	VARIANT_BOOL			bLoaded;
	VARIANT					value;
	BSTR					nodeName;
	POINT					pt;
	long					n;

	if (SUCCEEDED(CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, IID_IXMLDOMDocument, (LPVOID*)&pDoc)))
	{
		pDoc->put_async(VARIANT_FALSE);
		pDoc->loadXML(strXML, &bLoaded);

		if (bLoaded == VARIANT_TRUE)
		{
			if (SUCCEEDED(pDoc->get_childNodes(&pNodeList)))
			{
				pInputNode = NULL;

				pNodeList->get_length(&n);

				for (int i = 0; i < n; i++)
				{
					if (SUCCEEDED(pNodeList->get_item(i, &pNode)))
					{
						nodeName = NULL;
						if (SUCCEEDED(pNode->get_nodeName(&nodeName)))
						{
							if (CComBSTR(nodeName) == L"input")
							{
								pInputNode = pNode;
								pInputNode->AddRef();
								break;
							}
							SysFreeString(nodeName);
						}
						pNode->Release();
					}
				}

				pNodeList->Release();

				if (pInputNode != NULL)
				{
					if (SUCCEEDED(pInputNode->get_childNodes(&pNodeList)))
					{
						pNodeList->get_length(&n);

						for (int i = 0; i < n; i++)
						{
							if (SUCCEEDED(pNodeList->get_item(i, &pNode)))
							{
								pt.x = 0;
								pt.y = 0;

								if (SUCCEEDED(pNode->get_attributes(&pNodeMap)))
								{
									if (SUCCEEDED(pNodeMap->getNamedItem(L"x", &pAttrNode)))
									{
										pAttrNode->get_nodeValue(&value);
										pt.x = _wtoi(value.bstrVal);
										pAttrNode->Release();
									}

									if (SUCCEEDED(pNodeMap->getNamedItem(L"y", &pAttrNode)))
									{
										pAttrNode->get_nodeValue(&value);
										pt.y = _wtoi(value.bstrVal);
										pAttrNode->Release();
									}

									pNodeMap->Release();
								}

								rgPoints.push_back(pt);

								pNode->Release();
							}
						}

						pNodeList->Release();
					}

					pInputNode->Release();
				}
			}
		}

		pDoc->Release();
	}
}
开发者ID:sanyaade-g2g-repos,项目名称:quickdiagram,代码行数:97,代码来源:StrokeRecognition.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: 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

示例11: InitTree

/**
 * InitTree
 * initialize the instance tree for the first time: get all necessary 
 * information from the kad and construct root and classes group nodes
 *
 * @return          TRUE: on success
 *                  FALSE: else
 * @exception       -
 * @see             
*/
BOOL CInstanceTree::InitTree()
{
    GetStaticInfos();

    // create project node
    CXMLNode docRoot;
    CXMLNode projectNode;

    PROJ_MAN_ASSERT(m_pProjectManager);

    CString strProjNodeId;
    strProjNodeId = m_pProjectManager->GetProjectName()+_T(".")+ID_PATH_INSTANCEVIEW;
    CString strVersion;
    strVersion.Format(_T("%i"), PRODUCT_BUILD);
    if (  (!m_domDocument.GetDocNode(docRoot))
        ||(!m_domDocument.CreateNode(projectNode, CE_XMLTAG_NODE))
        ||(!docRoot.AppendChild(projectNode))
        ||(!projectNode.SetAttribute(CE_XMLATTR_TEXT, m_pProjectManager->GetProjectName()))
        ||(!projectNode.SetAttribute(CE_XMLATTR_ID, strProjNodeId))
        ||(!projectNode.SetAttribute(CE_XMLATTR_PARSERSOURCE, m_pProjectManager->GetProjectFileName()))
        ||(!projectNode.SetAttribute(CE_XMLATTR_TYPE, m_strInstancesType))
        ||(!projectNode.SetAttribute(PRJMAN_VERSION, strVersion))    )
    {
        return FALSE;
    }

    Reparse4CPAttributes(&projectNode);

    // add project file to source file list
    TSourceFileInfo* pProjFileInfo;
    CString strProjFileName = m_pProjectManager->GetProjectFileName();
    pProjFileInfo = CreateSourceFileInfo(strProjFileName,
                                         projectNode,  _T(""));
    PROJ_MAN_ASSERT(pProjFileInfo);
    pProjFileInfo->strIdPath = CE_XML_IDPATH_SEP + strProjNodeId;
    SetSourceTime(pProjFileInfo, m_pProjectManager->GetProjectFileNameWithPath());
    SourceFileMap_SetAt(strProjFileName, pProjFileInfo, m_mapSourceFiles);

    // update targets
    UpdateTargets();

    Reparse(FALSE);

    ExpandFromViewData();

    IXMLDOMDocument *pXMLDoc;
    m_domDocument.GetIXMLDocument(&pXMLDoc);
    m_pProjectManager->Fire_InitInstanceTree((IUnknown*)pXMLDoc);
    pXMLDoc->Release();

    m_bInit = FALSE;

    POSITION pos = m_mapInstanceTargets.GetStartPosition();
    while(pos)
    {
        CString strId;
        TInstanceTargetInfo* pInfo;
        m_mapInstanceTargets.GetNextAssoc(pos, strId, pInfo);
        if (pInfo)
        {
            CComBSTR sId = pInfo->strTargetId;
            CComBSTR sIdPath = pInfo->strIdPath;
            m_pProjectManager->Fire_TargetInstanceAdded(sId, sIdPath);
        }
    }

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

示例12: Merge

HRESULT CKADmerge::Merge(string sAddOnFileName, BOOL bOverwrite, string sLogFile)
{
    HRESULT hRes = 0;

	IXMLDOMDocument * pXMLAddOn = NULL;

    if(sLogFile != "")
    {
        // open log file
        OpenLog(sLogFile, sDescription + " " + m_sFileName + " with " + sAddOnFileName);
    }

    try
	{
        // load AddOn file
        hRes = LoadXMLFile(sAddOnFileName, &pXMLAddOn);

        IXMLDOMElement * pKadRoot = NULL;
        hRes = GetRootElement(m_pXMLKad, &pKadRoot);
        if(hRes == S_FALSE)
        {
            // create root element
            hRes = GetRootElement(pXMLAddOn, &pKadRoot);
            if(hRes == S_FALSE)
            {
                throw string("ERROR: could not get addon kad root element: " + sAddOnFileName);
            }

            _bstr_t bTagName(GetName(pKadRoot).c_str());
            hRes = m_pXMLKad->createElement(bTagName, &pKadRoot);
            hRes = m_pXMLKad->putref_documentElement(pKadRoot);

            // log changes
            Log("Create Root-Element: " + GetName(pKadRoot) );

            m_bIsDirty = TRUE;
        }

        if(pKadRoot)
            pKadRoot->Release();

	    IXMLDOMNode * pXMLKadNode = NULL;
	    IXMLDOMNode * pXMLAddOnNode = NULL;

        hRes = GetRootElement(m_pXMLKad, &pXMLKadNode);
        hRes = GetRootElement(pXMLAddOn, &pXMLAddOnNode);

        // copy nodes
        hRes = CopyNode(&pXMLKadNode, &pXMLAddOnNode, bOverwrite, "");

	    if(pXMLKadNode != NULL)
		    pXMLKadNode->Release();
	    if(pXMLAddOnNode != NULL)
		    pXMLAddOnNode->Release();

        if(m_bIsDirty)
        {
            hRes = SaveXMLFile(m_sFileName, m_pXMLKad);
            m_bIsDirty = FALSE;
        }
	}
	catch(string str)
	{
        Log(str);
        hRes = S_FALSE;
	}

	if(pXMLAddOn != NULL)
		pXMLAddOn->Release();

    // close log file
    CloseLog();

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


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