本文整理汇总了C++中msxml2::IXMLDOMNodePtr::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMNodePtr::Release方法的具体用法?C++ IXMLDOMNodePtr::Release怎么用?C++ IXMLDOMNodePtr::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msxml2::IXMLDOMNodePtr
的用法示例。
在下文中一共展示了IXMLDOMNodePtr::Release方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nParseTSFile
/******************************************************************************
Function Name : nParseTSFile
Input(s) : CString omstrTSFile
Output : INT
Functionality : Load the omStrTSFille
Member of : CTestSetupEntity
Friend of : -
Author(s) : Venkatanarayana Makam
Date Created : 06/04/2011
Modifications :
Codetag : CS002
******************************************************************************/
INT CTestSetupEntity::nParseTSFile(CString omstrTSFile)
{
MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
HRESULT hr = pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");
if ( FAILED(hr) )
{
throw "Unable to create XML parser object";
}
if(PathFileExists(omstrTSFile) == FALSE)
{
return ERR_PATH_INCORRECT;
}
//Create A TestSetup DOM document
CComVariant varFileName((LPCSTR)omstrTSFile);
try
{
pIDOMDoc->load(varFileName);
//GetTest Setup Title
MSXML2::IXMLDOMNodePtr pIDOMTiltleNode;
_bstr_t bstrNodeName = def_STR_TSNODE_NAME;
CComVariant NodeValue;
pIDOMTiltleNode = pIDOMDoc->selectSingleNode(bstrNodeName);
MSXML2::IXMLDOMNamedNodeMapPtr pDOMTCAtrributes;
pDOMTCAtrributes = pIDOMTiltleNode->Getattributes();
MSXML2::IXMLDOMNodePtr pIDOMChildNode;
//bstrNodeName = def_STR_TSATTRIB_TITLE;
bstrNodeName.Assign(SysAllocString(CT2W(def_STR_TSATTRIB_TITLE)));
pIDOMChildNode = pDOMTCAtrributes->getNamedItem(bstrNodeName);
pIDOMChildNode->get_nodeTypedValue(&NodeValue);
m_omstrTestSetupTitle = strCopyBSTRToCString(NodeValue);
pIDOMChildNode.Release();
//Get Description
//bstrNodeName = def_STR_TSDESCRIPTION;
bstrNodeName.Assign(SysAllocString(CT2W(def_STR_TSDESCRIPTION)));
MSXML2::IXMLDOMNodePtr pIDOMDescriptionNode = pIDOMDoc->selectSingleNode(bstrNodeName);
pIDOMDescriptionNode->get_nodeTypedValue(&NodeValue);
m_omstrDescription = strCopyBSTRToCString(NodeValue);
//Get Header Node
//bstrNodeName = def_STR_TSHEADER;
bstrNodeName.Assign(SysAllocString(CT2W(def_STR_TSHEADER)));
MSXML2::IXMLDOMNodePtr pIDOMHeaderNode = pIDOMDoc->selectSingleNode(bstrNodeName);
nLoadHeader(pIDOMHeaderNode);
pIDOMHeaderNode.Release();
//Get TestCases List
//bstrNodeName = def_STR_TSTCLIST;
bstrNodeName.Assign(SysAllocString(CT2W(def_STR_TSTCLIST)));
MSXML2::IXMLDOMNodePtr pIDOMTSNode = pIDOMDoc->selectSingleNode(bstrNodeName);
GetData(pIDOMTSNode);
}
catch(...)
{
return S_FALSE;
}
return S_OK;
}
示例2: GetTextForSmartTagName
CStdString SmartTagParser::GetTextForSmartTagName(const CStdString & SmartTagName)
{
if (m_spXMLDom == NULL)
{
CStdString msg;
msg.Format(_T("SmartTagParser::GetTextForSmartTagName - The XML document pointer is null."));
throw Workshare::NullReferenceException(msg);
}
CComBSTR nodeText = _T("//");
nodeText += GetNamespacePrefix();
nodeText += _T(":");
nodeText += SmartTagName;
MSXML2::IXMLDOMNodePtr pNode = m_spXMLDom->selectSingleNode(nodeText.m_str);
if (pNode == NULL)
{
CStdString msg;
msg.Format(_T("SmartTagParser::GetTextForSmartTagName - Failed to get node (%s) from the XML"), nodeText);
throw Workshare::Exception(msg);
}
CStdString sValue = pNode->text;
if (pNode)
{
pNode.Release();
}
return sValue;
}
示例3: DeleteChild
// 删除子结点
int CBpXMLNode::DeleteChild(const IBpXMLNode *pNodeChild)
{
if (m_pDOMNode == NULL || pNodeChild == NULL || ((CBpXMLNode*)pNodeChild)->m_pDOMNode == NULL)
return XML_ERROR;
try
{
MSXML2::IXMLDOMNodePtr pTempNode = m_pDOMNode->removeChild(((CBpXMLNode*)pNodeChild)->m_pDOMNode);
if (pTempNode == NULL)
return XML_ERROR;
pTempNode->Release();
}
catch (...)
{
return XML_ERROR;
}
return XML_OK;
}
示例4: AppendNewElementChild
// 根据给定的名字,创建Element节点,并将其附加为当前节点的子节点
IBpXMLNode* CBpXMLNode::AppendNewElementChild(const wchar_t *szElementName)
{
if (m_pDOMNode == NULL)
return NULL;
MSXML2::IXMLDOMDocument *pDOMDocPtr = NULL;
m_pDOMNode->get_ownerDocument(&pDOMDocPtr);
if (pDOMDocPtr == NULL)
return NULL;
// 创建Element
VARIANT vtTemp;
vtTemp.vt = VT_I2;
vtTemp.iVal = 1;
MSXML2::IXMLDOMNodePtr pDOMNodeCreated = pDOMDocPtr->createNode(vtTemp, _bstr_t(szElementName), L"");
if (pDOMNodeCreated == NULL)
return NULL;
// 用来指向被附加后的节点
MSXML2::IXMLDOMNodePtr pNodeAppend = NULL;
try
{
pNodeAppend = m_pDOMNode->appendChild(pDOMNodeCreated);
}
catch (...)
{
return NULL;
}
if (pNodeAppend == NULL)
{
pDOMNodeCreated->Release();
return NULL;
}
CBpXMLNode* pElemCreated = new CBpXMLNode;
pElemCreated->m_pDOMNode = pNodeAppend;
return pElemCreated;
}
示例5: GetData
/******************************************************************************
Function Name : GetData
Input(s) : MSXML2::IXMLDOMNodePtr& pIDomNode
Output : HRESULT
Functionality :
Member of : CWaitEntity
Friend of : -
Author(s) : Venkatanarayana Makam
Date Created : 06/04/2011
Modifications :
******************************************************************************/
HRESULT CWaitEntity::GetData(MSXML2::IXMLDOMNodePtr& pIDomNode)
{
_bstr_t bstrNodeName;
CComVariant NodeValue;
MSXML2::IXMLDOMNamedNodeMapPtr pDOMWaitAtrributes;
pDOMWaitAtrributes = pIDomNode->Getattributes();
MSXML2::IXMLDOMNodePtr pIDOMChildNode;
//bstrNodeName = L"purpose";
bstrNodeName.Assign(SysAllocString(CT2W("purpose")));
pIDOMChildNode = pDOMWaitAtrributes->getNamedItem(bstrNodeName);
pIDOMChildNode->get_nodeTypedValue(&NodeValue);
m_ouData.m_omPurpose = strCopyBSTRToCString(NodeValue);
pIDomNode->get_nodeTypedValue(&NodeValue);
CString strTemp;
strTemp = strCopyBSTRToCString(NodeValue);
//W4 Removal - Type Conversion No problem.
m_ouData.m_ushDuration = (USHORT)atoi((LPCSTR)strTemp);
pIDOMChildNode.Release();
pDOMWaitAtrributes.Release();
return S_OK;
}
示例6: CreateXmlTitle
MSXML2::IXMLDOMNodePtr CXmlBase::CreateXmlTitle(MSXML2::IXMLDOMDocument2Ptr pDoc)
{
MSXML2::IXMLDOMProcessingInstructionPtr pi = NULL;
MSXML2::IXMLDOMNodePtr pNode = NULL;
if (pDoc == NULL) return NULL;
try
{
pi = pDoc->createProcessingInstruction(_T("xml")
, _T("version=\"1.0\" encoding=\"UTF-8\""));
if (pi == NULL) return NULL;
pNode = pi;
if (NULL == (pNode = pDoc->appendChild(pNode)))
{
pi.Release();
pNode.Release();
return NULL;
}
pi.Release();
//pNode.Release();
}
catch(_com_error &e)
{
CString str;
str.Format(_T("创建xml头发生异常。\r\nComError:\r\n%s")
, e.ErrorMessage());
::MessageBox( NULL,str, g_sAppTitle, MB_OK|MB_ICONERROR);
return NULL;
}
catch(...)
{
return NULL;
}
return pNode;
}
示例7: nLoadHeader
/******************************************************************************
Function Name : nLoadHeader
Input(s) : MSXML2::IXMLDOMNodePtr& pHeaderDOMNode
Output : INT
Functionality : Retrives the Header info
Member of : CTestSetupEntity
Friend of : -
Author(s) : Venkatanarayana Makam
Date Created : 06/04/2011
Modifications :
Codetag :
******************************************************************************/
INT CTestSetupEntity::nLoadHeader(MSXML2::IXMLDOMNodePtr& pHeaderDOMNode)
{
// CComPtr<IXMLDOMNode> pHeaderDOMNode;
MSXML2::IXMLDOMNodeListPtr pXMLDOMInfoList;
MSXML2::IXMLDOMNodePtr pInfoNode;
MSXML2::IXMLDOMNodePtr pInfoCategoryNode;
MSXML2::IXMLDOMNodePtr pInfoValueNode;
_bstr_t bstrNodeName = "info";
CComVariant NodeValue;
pXMLDOMInfoList = pHeaderDOMNode->selectNodes(bstrNodeName);
LONG lCount = 0;
pXMLDOMInfoList->get_length(&lCount);
SInfo ouTempSInfo;
for(int i = 0; i<lCount; i++)
{
pInfoNode = pXMLDOMInfoList->Getitem(i);
//bstrNodeName = def_STR_CATEGORY_NODE;
bstrNodeName.Assign(SysAllocString(CT2W(def_STR_CATEGORY_NODE)));
pInfoCategoryNode = pInfoNode->selectSingleNode(bstrNodeName);
pInfoCategoryNode->get_nodeTypedValue(&NodeValue);
ouTempSInfo.m_omCategory = strCopyBSTRToCString(NodeValue);
pInfoCategoryNode.Release();
//bstrNodeName = def_STR_VALUE_NODE;
bstrNodeName.Assign(SysAllocString(CT2W(def_STR_VALUE_NODE)));
pInfoCategoryNode = pInfoNode->selectSingleNode(bstrNodeName);
pInfoCategoryNode->get_nodeTypedValue(&NodeValue);
ouTempSInfo.m_omValue = strCopyBSTRToCString(NodeValue);
pInfoCategoryNode.Release();
pInfoNode.Release();
if(ouTempSInfo.m_omCategory == def_STR_MODULENAME)
{
m_ouTestSetupHeader.m_sModuleName.m_omCategory = ouTempSInfo.m_omCategory;
m_ouTestSetupHeader.m_sModuleName.m_omValue = ouTempSInfo.m_omValue;
}
if(ouTempSInfo.m_omCategory == def_STR_ENGINEERNAME)
{
m_ouTestSetupHeader.m_sEngineerInfo1.m_omCategory = ouTempSInfo.m_omCategory;
m_ouTestSetupHeader.m_sEngineerInfo1.m_omValue = ouTempSInfo.m_omValue;
}
if(ouTempSInfo.m_omCategory == def_STR_ENGINERROLE)
{
m_ouTestSetupHeader.m_sEngineerInfo2.m_omCategory = ouTempSInfo.m_omCategory;
m_ouTestSetupHeader.m_sEngineerInfo2.m_omValue = ouTempSInfo.m_omValue;
}
if(ouTempSInfo.m_omCategory == def_STR_VERSION)
{
m_ouTestSetupHeader.m_sVersion.m_omCategory = ouTempSInfo.m_omCategory;
m_ouTestSetupHeader.m_sVersion.m_omValue = ouTempSInfo.m_omValue;
}
}
//Taking Database
//bstrNodeName = def_STR_LISTOFDB;
bstrNodeName.Assign(SysAllocString(CT2W(def_STR_LISTOFDB)));
pInfoNode = pHeaderDOMNode->selectSingleNode(bstrNodeName);
pInfoNode->get_nodeTypedValue(&NodeValue);
m_ouTestSetupHeader.m_omDatabasePath = strCopyBSTRToCString(NodeValue);
//Set The Database Path
SetDatabaseFile(m_ouTestSetupHeader.m_omDatabasePath);
pInfoNode.Release();
//bstrNodeName = def_STR_REPORT_FORMAT;
bstrNodeName.Assign(SysAllocString(CT2W(def_STR_REPORT_FORMAT)));
pInfoNode = pHeaderDOMNode->selectSingleNode(bstrNodeName);
pInfoNode->get_nodeTypedValue(&NodeValue);
CString omStrExt;
omStrExt = strCopyBSTRToCString(NodeValue);
pInfoNode.Release();
if(omStrExt == "HTM")
{
m_ouTestSetupHeader.m_sReportFile.m_eType = HTM;
}
else
{
m_ouTestSetupHeader.m_sReportFile.m_eType = TXT;
}
//bstrNodeName = def_STR_REPORT_PATH;
//.........这里部分代码省略.........