本文整理汇总了C++中DOMDocument::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMDocument::Release方法的具体用法?C++ DOMDocument::Release怎么用?C++ DOMDocument::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMDocument
的用法示例。
在下文中一共展示了DOMDocument::Release方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadProject
//-----------------------------------------------------------------------------
// Purpose: load up a project and parse it
//-----------------------------------------------------------------------------
bool CVCProjConvert::LoadProject( const char *project )
{
#ifdef _WIN32
HRESULT hr;
IXMLDOMDocument *pXMLDoc=NULL;
hr = ::CoCreateInstance(CLSID_DOMDocument,
NULL,
CLSCTX_INPROC_SERVER,
IID_IXMLDOMDocument,
(void**)&pXMLDoc);
if (FAILED(hr))
{
Msg ("Cannot instantiate msxml2.dll\n");
Msg ("Please download the MSXML run-time (url below)\n");
Msg ("http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/msdn-files/027/001/766/msdncompositedoc.xml\n");
return false;
}
VARIANT_BOOL vtbool;
_variant_t bstrProject(project);
pXMLDoc->put_async( VARIANT_BOOL(FALSE) );
hr = pXMLDoc->load(bstrProject,&vtbool);
if (FAILED(hr) || vtbool==VARIANT_FALSE)
{
Msg ("Could not open %s.\n", bstrProject);
pXMLDoc->Release();
return false;
}
#elif _LINUX
XercesDOMParser* parser = new XercesDOMParser();
parser->setValidationScheme(XercesDOMParser::Val_Always); // optional.
parser->setDoNamespaces(true); // optional
ErrorHandler* errHandler = (ErrorHandler*) new HandlerBase();
parser->setErrorHandler(errHandler);
try {
parser->parse(project);
}
catch (const XMLException& toCatch) {
char* message = XMLString::transcode(toCatch.getMessage());
Error( "Exception message is: %s\n", message );
XMLString::release(&message);
return;
}
catch (const DOMException& toCatch) {
char* message = XMLString::transcode(toCatch.msg);
Error( "Exception message is: %s\n", message );
XMLString::release(&message);
return;
}
catch (...) {
Error( "Unexpected Exception \n" );
return;
}
DOMDocument *pXMLDoc = parser->getDocument();
#endif
ExtractProjectName( pXMLDoc );
if ( !m_Name.IsValid() )
{
Msg( "Failed to extract project name\n" );
return false;
}
char baseDir[ MAX_PATH ];
Q_ExtractFilePath( project, baseDir, sizeof(baseDir) );
Q_StripTrailingSlash( baseDir );
m_BaseDir = baseDir;
ExtractConfigurations( pXMLDoc );
if ( m_Configurations.Count() == 0 )
{
Msg( "Failed to find any configurations to load\n" );
return false;
}
ExtractFiles( pXMLDoc );
#ifdef _WIN32
pXMLDoc->Release();
#elif _LINUX
delete pXMLDoc;
delete errHandler;
#endif
m_bProjectLoaded = true;
return true;
}