本文整理汇总了C++中msxml2::IXMLDOMElementPtr::setAttributeNode方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMElementPtr::setAttributeNode方法的具体用法?C++ IXMLDOMElementPtr::setAttributeNode怎么用?C++ IXMLDOMElementPtr::setAttributeNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msxml2::IXMLDOMElementPtr
的用法示例。
在下文中一共展示了IXMLDOMElementPtr::setAttributeNode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetData
/******************************************************************************
Function Name : SetData
Input(s) :
Output : HRESULT
Functionality :
Member of : CVerifyResponse
Friend of : -
Author(s) : Venkatanarayana Makam
Date Created : 06/04/2011
Modifications :
******************************************************************************/
HRESULT CVerifyResponse::SetData(MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode)
{
CString omstrTemp;
MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");
INT lCount = (INT)m_ouData.m_odVerify_MessageEntityList.GetCount();
MSXML2::IXMLDOMElementPtr pIDomSendNode = pIDOMDoc->createElement(_bstr_t(def_STR_VERIFYRES_NODE));
MSXML2::IXMLDOMAttributePtr pIDomTSAtrrib = pIDOMDoc->createAttribute(def_STR_ATTRIB_FAIL);
if(pIDomTSAtrrib!= NULL)
{
switch(m_ouData.m_eAttributeError)
{
case SUCCESS:
omstrTemp = "SUCCESS";
break;
case WARNING:
omstrTemp = "WARNING";
break;
case FATAL:
omstrTemp = "FATAL";
break;
case ERRORS:
default:
omstrTemp = "ERRORS";
break;
}
pIDomTSAtrrib->value = _bstr_t(omstrTemp);
pIDomSendNode->setAttributeNode(pIDomTSAtrrib);
}
MSXML2::IXMLDOMAttributePtr pIDomTSAtrribWait = pIDOMDoc->createAttribute(def_STR_ATTRIB_WAITFOR);
if(pIDomTSAtrribWait!= NULL)
{
CString omstrWaitFor;
omstrWaitFor.Format("%d", m_ushDuration);
pIDomTSAtrribWait->value = _bstr_t(omstrWaitFor);
pIDomSendNode->setAttributeNode(pIDomTSAtrribWait);
}
for(INT i=0; i<lCount; i++)
{
POSITION pos = m_ouData.m_odVerify_MessageEntityList.FindIndex(i);
CVerify_MessageEntity& ouVerifyMsgEntity = m_ouData.m_odVerify_MessageEntityList.GetAt(pos);
ouVerifyMsgEntity.SetData(pIDomSendNode);
}
pIDomTestCaseNode->appendChild(pIDomSendNode);
return S_OK;
}
示例2: SetData
/******************************************************************************
Function Name : SetData
Input(s) : MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode
Output : HRESULT
Functionality :
Member of : CTestCaseEntity
Friend of : -
Author(s) : Venkatanarayana Makam
Date Created : 06/04/2011
Modifications :
******************************************************************************/
HRESULT CTestCaseEntity::SetData(MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode)
{
CString omstrTemp;
MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");
MSXML2::IXMLDOMAttributePtr pIDomTSAtrrib = pIDOMDoc->createAttribute(def_STR_TCATTRIB_ID);
if(pIDomTSAtrrib!= NULL)
{
pIDomTSAtrrib->value = _bstr_t(m_ouData.m_omID);
pIDomTestCaseNode->setAttributeNode(pIDomTSAtrrib);
}
pIDomTSAtrrib = pIDOMDoc->createAttribute(def_STR_TCATTRIB_TITLE);
if(pIDomTSAtrrib!= NULL)
{
pIDomTSAtrrib->value = _bstr_t(m_ouData.m_omTitle);
pIDomTestCaseNode->setAttributeNode(pIDomTSAtrrib);
}
pIDomTSAtrrib = pIDOMDoc->createAttribute(def_STR_TCATTRIB_H_EXP);
if(pIDomTSAtrrib!= NULL)
{
switch(m_ouData.m_eExcpAction)
{
case EXIT:
omstrTemp = "EXIT";
break;
case CONTINUE:
default:
omstrTemp = "CONTINUE";
break;
}
pIDomTSAtrrib->value = _bstr_t(omstrTemp);
pIDomTestCaseNode->setAttributeNode(pIDomTSAtrrib);
}
INT lCount = (INT)m_ouData.m_odTAEntityList.GetCount();
for(int i=0; i<lCount;i++)
{
POSITION pos = m_ouData.m_odTAEntityList.FindIndex(i);
CBaseEntityTA* pEntity = m_ouData.m_odTAEntityList.GetAt(pos);
pEntity->SetData(pIDomTestCaseNode);
}
return 0;
}
示例3: SaveFileAs
/******************************************************************************
Function Name : SaveFileAs
Input(s) : CString omFilePath
Output : HRESULT
Functionality :
Member of : CTestSetupEntity
Friend of : -
Author(s) : Venkatanarayana Makam
Date Created : 06/04/2011
Modifications :
Codetag : CS006
******************************************************************************/
HRESULT CTestSetupEntity::SaveFileAs(CString omFilePath)
{
if(omFilePath.IsEmpty() == TRUE)
{
return S_FALSE;
}
MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
HRESULT hr = pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");
if ( FAILED(hr) )
{
return S_FALSE;
}
MSXML2::IXMLDOMProcessingInstructionPtr pIDomPi;
pIDomPi = pIDOMDoc->createProcessingInstruction(def_DOM_INSTRUCTION);
VARIANT_BOOL b = TRUE;
pIDOMDoc->put_preserveWhiteSpace(b);
if (pIDomPi != nullptr)
{
pIDOMDoc->appendChild(pIDomPi);
}
//testSETUP Node <testsetup>
MSXML2::IXMLDOMElementPtr pIDomTSNode = pIDOMDoc->createElement(_bstr_t(def_STR_TSNODE_NAME));
pIDOMDoc->appendChild(pIDomTSNode);
//Title Attribute <testsetup title = "">
MSXML2::IXMLDOMAttributePtr pIDomTSAtrrib = pIDOMDoc->createAttribute(def_STR_TSATTRIB_TITLE);
if(pIDomTSAtrrib!= nullptr)
{
pIDomTSAtrrib->value = _bstr_t(m_omstrTestSetupTitle);
pIDomTSNode->setAttributeNode(pIDomTSAtrrib);
}
//Descriprion Node <testsetup title = ""><description>
MSXML2::IXMLDOMElementPtr pIDomDescriptionNode = pIDOMDoc->createElement(_bstr_t(def_STR_DESC_NODE));
pIDomDescriptionNode->Puttext(_bstr_t(m_omstrDescription));
pIDomTSNode->appendChild(pIDomDescriptionNode);
//Heade Node
MSXML2::IXMLDOMElementPtr pIDomHeaderNode = pIDOMDoc->createElement(_bstr_t(def_STR_HEADER_NAME));
nSaveHeader(pIDomHeaderNode, omFilePath);
pIDomTSNode->appendChild(pIDomHeaderNode);
//TestCase List
MSXML2::IXMLDOMElementPtr pIDomTestCaseNode = pIDOMDoc->createElement(_bstr_t(def_STR_TCLIST_NODE));
SetData(pIDomTestCaseNode);
pIDomTSNode->appendChild(pIDomTestCaseNode);
FormatDOMDocument(pIDOMDoc, omFilePath);
return S_OK;
}
示例4: SetData
/******************************************************************************
Function Name : SetData
Input(s) :
Output : HRESULT
Functionality :
Member of : CVerifyEntity
Friend of : -
Author(s) : Venkatanarayana Makam
Date Created : 06/04/2011
Modifications :
******************************************************************************/
HRESULT CVerifyEntity::SetData(MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode)
{
CString omstrTemp;
MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");
int lCount = m_ouData->m_odVerifySubEntityList.size();
MSXML2::IXMLDOMElementPtr pIDomSendNode = pIDOMDoc->createElement(_bstr_t(def_STR_VERIFY_NODE));
MSXML2::IXMLDOMAttributePtr pIDomTSAtrrib = pIDOMDoc->createAttribute(def_STR_ATTRIB_FAIL);
if(pIDomTSAtrrib!= NULL)
{
switch(m_ouData->m_eAttributeError)
{
case SUCCESS:
omstrTemp = "SUCCESS";
break;
case WARNING:
omstrTemp = "WARNING";
break;
case FATAL:
omstrTemp = "FATAL";
break;
case ERRORS:
default:
omstrTemp = "ERRORS";
break;
}
pIDomTSAtrrib->value = _bstr_t(omstrTemp);
pIDomSendNode->setAttributeNode(pIDomTSAtrrib);
}
for(INT i=0; i<lCount; i++)
{
CVerifySubEntity *pVerifySubEntity = m_ouData->m_odVerifySubEntityList[i];
pVerifySubEntity->SetData(pIDomSendNode);
}
pIDomTestCaseNode->appendChild(pIDomSendNode);
return S_OK;
}