本文整理汇总了C++中msxml2::IXMLDOMElementPtr::Puttext方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMElementPtr::Puttext方法的具体用法?C++ IXMLDOMElementPtr::Puttext怎么用?C++ IXMLDOMElementPtr::Puttext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msxml2::IXMLDOMElementPtr
的用法示例。
在下文中一共展示了IXMLDOMElementPtr::Puttext方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetNodeValue
//设置指定xpath的节点值
BOOL CXmlBase::SetNodeValue(LPCTSTR lpszValue, MSXML2::IXMLDOMNodePtr pNode)
{
if (pNode == NULL) return FALSE;
if (lpszValue == NULL) return FALSE;
MSXML2::IXMLDOMElementPtr pElem = pNode;
pElem->Puttext(lpszValue);
return TRUE;
}
示例2: 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;
}
示例3: SetData
/******************************************************************************
Function Name : SetData
Input(s) : MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode
Output : HRESULT
Functionality :
Member of : CReplayEntity
Friend of : -
Author(s) : Venkatanarayana Makam
Date Created : 06/04/2011
Modifications :
******************************************************************************/
HRESULT CReplayEntity::SetData(MSXML2::IXMLDOMElementPtr& pIDomTestCaseNode)
{
CString omstrTemp;
MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");
if (pIDOMDoc != NULL)
{
MSXML2::IXMLDOMElementPtr pIDomWaitNode = pIDOMDoc->createElement(_bstr_t(def_STR_REPLAY_NODE));
pIDomWaitNode->Puttext(_bstr_t(m_omFilePath));
pIDomTestCaseNode->appendChild(pIDomWaitNode);
}
return S_OK;
}
示例4: bAddChildToNode
/******************************************************************************
Function Name : bAddChildToNode
Input(s) : MSXML2::IXMLDOMElementPtr& pNodeElement,
CString omNodeName
CString omNodeval
Output : BOOL
Functionality :
Member of : CTestSetupEntity
Friend of : -
Author(s) : Venkatanarayana Makam
Date Created : 06/04/2011
Modifications :
******************************************************************************/
BOOL CTestSetupEntity::bAddChildToNode(MSXML2::IXMLDOMElementPtr& pNodeElement,
CString omNodeName, CString omNodeval)
{
BOOL bReturn = FALSE;
MSXML2::IXMLDOMElementPtr pChildElement;
MSXML2::IXMLDOMDocumentPtr m_pXMLDom;
m_pXMLDom.CreateInstance(L"Msxml2.DOMDocument");
if (pNodeElement != NULL)
{
pChildElement = m_pXMLDom->createElement(_bstr_t(omNodeName));
if (pChildElement != NULL)
{
pChildElement->Puttext((_bstr_t)omNodeval);
pNodeElement->appendChild(pChildElement);
bReturn = TRUE;
}
}
return bReturn;
}
示例5: nSaveHeader
/******************************************************************************
Function Name : nSaveHeader
Input(s) :
Output : INT
Functionality :
Member of : CTestSetupEntity
Friend of : -
Author(s) : Venkatanarayana Makam
Date Created : 06/04/2011
Modifications :
Codetag : CS025
******************************************************************************/
INT CTestSetupEntity::nSaveHeader(MSXML2::IXMLDOMElementPtr& pIDomHeaderNode, CString& omStrFilePath)
{
MSXML2::IXMLDOMDocumentPtr pIDOMDoc;
pIDOMDoc.CreateInstance(L"Msxml2.DOMDocument");
MSXML2::IXMLDOMElementPtr pChildElement;
MSXML2::IXMLDOMElementPtr pInfoElement;
CString omstrTemp;
//Module Info
pInfoElement = pIDOMDoc->createElement(_bstr_t(def_STR_INFO_NODE));
if (pInfoElement != NULL)
{
bAddChildToNode(pInfoElement, def_STR_CATEGORY_NODE, m_ouTestSetupHeader.m_sModuleName.m_omCategory);
bAddChildToNode(pInfoElement, def_STR_VALUE_NODE, m_ouTestSetupHeader.m_sModuleName.m_omValue);
}
pIDomHeaderNode->appendChild(pInfoElement);
//Version
pInfoElement = pIDOMDoc->createElement(_bstr_t(def_STR_INFO_NODE));
if (pInfoElement != NULL)
{
bAddChildToNode(pInfoElement, def_STR_CATEGORY_NODE, m_ouTestSetupHeader.m_sVersion.m_omCategory);
bAddChildToNode(pInfoElement, def_STR_VALUE_NODE, m_ouTestSetupHeader.m_sVersion.m_omValue);
}
pIDomHeaderNode->appendChild(pInfoElement);
//Engineer Name
pInfoElement = pIDOMDoc->createElement(_bstr_t(def_STR_INFO_NODE));
if (pInfoElement != NULL)
{
bAddChildToNode(pInfoElement, def_STR_CATEGORY_NODE, m_ouTestSetupHeader.m_sEngineerInfo1.m_omCategory);
bAddChildToNode(pInfoElement, def_STR_VALUE_NODE, m_ouTestSetupHeader.m_sEngineerInfo1.m_omValue);
}
pIDomHeaderNode->appendChild(pInfoElement);
//Engineer Role
pInfoElement = pIDOMDoc->createElement(_bstr_t(def_STR_INFO_NODE));
if (pInfoElement != NULL)
{
bAddChildToNode(pInfoElement, def_STR_CATEGORY_NODE, m_ouTestSetupHeader.m_sEngineerInfo2.m_omCategory);
bAddChildToNode(pInfoElement, def_STR_VALUE_NODE, m_ouTestSetupHeader.m_sEngineerInfo2.m_omValue);
}
pIDomHeaderNode->appendChild(pInfoElement);
//Bus Type
pInfoElement = pIDOMDoc->createElement(_bstr_t(def_STR_DBPATH_NODE));
bAddChildToNode(pInfoElement, def_STR_DATABASE, m_ouTestSetupHeader.m_omDatabasePath);
pIDomHeaderNode->appendChild(pInfoElement);
//Database Path
pInfoElement = pIDOMDoc->createElement(_bstr_t(def_STR_BUS_TYPE));
if(m_ouTestSetupHeader.m_eBus == CAN)
{
omstrTemp = "CAN";
}
pInfoElement->Puttext(_bstr_t(omstrTemp));
pIDomHeaderNode->appendChild(pInfoElement);
//Report File
pInfoElement = pIDOMDoc->createElement(_bstr_t(def_STR_REPORT_NODE));
if (pInfoElement != NULL)
{
switch(m_ouTestSetupHeader.m_sReportFile.m_eType)
{
case HTM:
omstrTemp = "HTM";
break;
case TXT:
default:
omstrTemp = "TXT";
break;
};
if(m_ouTestSetupHeader.m_sReportFile.m_omPath == "")
{
CString omReportPath(omStrFilePath);
int nIndex = omReportPath.Find(".xml");
omReportPath.Delete(nIndex, 4);
CFile omFile(omStrFilePath, CFile::modeRead);
CString omReportName = omFile.GetFileTitle() + _T(".") + omstrTemp;
omReportPath += omReportName;
m_ouTestSetupHeader.m_sReportFile.m_omPath = omReportPath;
}
//.........这里部分代码省略.........