本文整理汇总了C++中msxml2::IXMLDOMNodePtr::Getattributes方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMNodePtr::Getattributes方法的具体用法?C++ IXMLDOMNodePtr::Getattributes怎么用?C++ IXMLDOMNodePtr::Getattributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msxml2::IXMLDOMNodePtr
的用法示例。
在下文中一共展示了IXMLDOMNodePtr::Getattributes方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetFileFormatVersion
void Translator::GetFileFormatVersion(std::string &fileFormatVersion, InputStream *readStream, TSError *error, char *errorMsg, long maxErrorMsgLengthInBytes)
{
readStream->Offset = 0;
GetParser()->LoadFile(readStream);
MSXML2::IXMLDOMNodePtr header = GetParser()->GetHeader(readStream);
fileFormatVersion = header->Getattributes()->getNamedItem("fileformatversion")->text;
}
示例2: GetData
/******************************************************************************
Function Name : GetData
Input(s) :
Output : HRESULT
Functionality :
Member of : CVerifyResponse
Friend of : -
Author(s) : Venkatanarayana Makam
Date Created : 06/04/2011
Modifications :
******************************************************************************/
HRESULT CVerifyResponse::GetData(MSXML2::IXMLDOMNodePtr& pIDomNode)
{
CVerifyEntity::GetData(pIDomNode);
_bstr_t bstrNodeName = def_STR_VERIFYMSG_NODE;
CComVariant NodeValue;
MSXML2::IXMLDOMNamedNodeMapPtr pDOMVerifyAtrributes;
MSXML2::IXMLDOMNodePtr pIDOMChildNode;
pDOMVerifyAtrributes = pIDomNode->Getattributes();
//bstrNodeName = def_STR_ATTRIB_WAITFOR;
bstrNodeName.Assign(SysAllocString(CT2W(def_STR_ATTRIB_WAITFOR)));
pIDOMChildNode = pDOMVerifyAtrributes->getNamedItem(bstrNodeName);
pIDOMChildNode->get_nodeTypedValue(&NodeValue);
CString strTemp;
strTemp = strCopyBSTRToCString(NodeValue);
//W4 Removal
m_ushDuration = (USHORT)atoi((LPCSTR)strTemp);
INT nCount = (INT)m_ouData.m_odVerify_MessageEntityList.GetCount();
for(int i = 0; i < nCount; i++)
{
CVerify_MessageData ouVerifyData;
POSITION pos = m_ouData.m_odVerify_MessageEntityList.FindIndex(i);
CVerify_MessageEntity& ouVerifyEntity = m_ouData.m_odVerify_MessageEntityList.GetAt(pos);
ouVerifyEntity.GetEntityData(VERIFY_MESSAGE, &ouVerifyData);
m_ouVerifyMsgMap[ouVerifyData.m_dwMessageID] = ouVerifyData;
}
return S_OK;
}
示例3: 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;
}
示例4: hodeHasAttribute
bool hodeHasAttribute(MSXML2::IXMLDOMNodePtr& node,
const String& attributeName, const String attributeNameSpace) {
MSXML2::IXMLDOMNamedNodeMapPtr attributes = node->Getattributes();
MSXML2::IXMLDOMNodePtr res = attributes->getQualifiedItem(attributeName.c_str(),
attributeNameSpace.c_str());
return res != NULL;
}
示例5: GetAttrsOfNode
int CXmlBase::GetAttrsOfNode(map<CString, CComBSTR>& mapAttrs, MSXML2::IXMLDOMNodePtr pNode)
{
MSXML2::IXMLDOMNamedNodeMapPtr pAttrs;
MSXML2::IXMLDOMNodePtr pAttr;
HRESULT hr;
CComBSTR bstrText;
CString str;
long lAttrCount = 0;
mapAttrs.clear();
if (NULL == pNode)
{
//WRITELOG("END, pNode为空");
return 0;
}
pAttrs = pNode->Getattributes();
if (pAttrs == NULL)
{
//WRITELOG("END, 取得节点属性集合失败");
return 0;
}
lAttrCount = pAttrs->Getlength();
for (int i=0; i<lAttrCount; i++)
{
pAttr = pAttrs->Getitem(i);
if (pAttr == NULL)
{
//WRITELOG("取得第[%d]个属性为空", i);
continue;
}
hr = pAttr->get_nodeName(&bstrText);
if (FAILED(hr))
{
//WRITELOG("取得第[%d]个属性名为空", i);
continue;
}
if (!ConvertBSTR2CString(str, bstrText.m_str))
{
//WRITELOG("转换第[%d]个属性名 失败", i);
continue;
}
hr = pAttr->get_text(&bstrText);
if (FAILED(hr))
{
//WRITELOG("取得第[%d]个属性值 失败,属性[%s]", i, str);
continue;
}
mapAttrs.insert(make_pair(str, bstrText));
}
return (int)mapAttrs.size();
}
示例6: GetCommonVerifyData
/******************************************************************************
Function Name : GetData
Input(s) :
Output : HRESULT
Functionality :
Member of : CVerifyEntity
Friend of : -
Author(s) : Venkatanarayana Makam
Date Created : 06/04/2011
Modifications :
******************************************************************************/
HRESULT CVerifyEntity::GetCommonVerifyData(MSXML2::IXMLDOMNodePtr& pIDomNode, CVerifyData *verifyData)
{
m_ouData = verifyData;
_bstr_t bstrNodeName = def_STR_VERIFYMSG_NODE;
CComVariant NodeValue;
MSXML2::IXMLDOMNamedNodeMapPtr pDOMVerifyAtrributes;
MSXML2::IXMLDOMNodePtr pIDOMChildNode;
pDOMVerifyAtrributes = pIDomNode->Getattributes();
//bstrNodeName = L"failure";
bstrNodeName.Assign(SysAllocString(CT2W("failure")));
pIDOMChildNode = pDOMVerifyAtrributes->getNamedItem(bstrNodeName);
pIDOMChildNode->get_nodeTypedValue(&NodeValue);
CString strTemp;
strTemp = strCopyBSTRToCString(NodeValue);
//m_ouData = new CVerifyData();
if(strTemp == "SUCCESS")
{
m_ouData->m_eAttributeError = SUCCESS;
}
else if(strTemp == "WARNING")
{
m_ouData->m_eAttributeError = WARNING;
}
else if(strTemp == "ERRORS")
{
m_ouData->m_eAttributeError = ERRORS;
}
else
{
m_ouData->m_eAttributeError = FATAL;
}
MSXML2::IXMLDOMNodeListPtr pIDOMSendList;
LONG lCount;
//bstrNodeName = def_STR_VERIFYMSG_NODE;
bstrNodeName.Assign(SysAllocString(CT2W(def_STR_VERIFYMSG_NODE)));
pIDOMSendList = pIDomNode->selectNodes(bstrNodeName);
pIDOMSendList->get_length(&lCount);
for(int i = 0; i < lCount; i++)
{
CVerifySubEntity *odVerifySubEntity;
MSXML2::IXMLDOMNodePtr pIXMLDOMVerifyMsgEntity;
pIXMLDOMVerifyMsgEntity = pIDOMSendList->Getitem(i);
//if(CVerifySubEntity::GetData(&odVerifySubEntity, pIXMLDOMVerifyMsgEntity) == S_OK)
if(this->GetSubEntityData(&odVerifySubEntity, pIXMLDOMVerifyMsgEntity) == S_OK)
{
m_ouData->m_odVerifySubEntityList.push_back(odVerifySubEntity);
}
}
return S_OK;
}
示例7: addTextAttributeToNode
void addTextAttributeToNode(MSXML2::IXMLDOMDocumentPtr& xmlDoc,
MSXML2::IXMLDOMNodePtr& targetNode, const String& attributeName,
const String& attributeValue) {
MSXML2::IXMLDOMNodePtr attributeNode =
xmlDoc->createNode(NODE_ATTRIBUTE, attributeName.c_str(), _T(""));
setNodeText(attributeNode, attributeValue);
MSXML2::IXMLDOMNamedNodeMapPtr attributes = targetNode->Getattributes();
if (attributes == NULL) {
throw XMLUtils::ParseError();
}
attributes->setNamedItem(attributeNode);
}
示例8: CanTranslate
//Check if the header info matches any of the supported file format headers.
bool Translator::CanTranslate(const char *fileExtension, InputStream* readStream, TSError *error, char* errorMsg, long maxErrorMsgLengthInBytes, bool checkfileExtension/*=true*/)
{
bool ret = false;
readStream->Offset = 0;
GetParser()->LoadFile(readStream);
MSXML2::IXMLDOMNodePtr header = GetParser()->GetHeader(readStream);
std::string description = header->Getattributes()->getNamedItem("description")->text;
if ( !m_TranslatorInfo.headerInfo.compare( description))
{
readStream->Offset = 0;
ret = true;
}
return ret;
}
示例9: 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;
}
示例10: GetData
/******************************************************************************
Function Name : GetData
Input(s) : MSXML2::IXMLDOMNodePtr& pIDomNode
Output : HRESULT
Functionality : Fill the datastructure from xml node pIDomNode
Member of : CVerify_MessageEntity
Friend of : -
Author(s) : Venkatanarayana Makam, GT-Derka
Date Created : 06/04/2011
Modifications :
******************************************************************************/
HRESULT CVerify_MessageEntity::GetData(MSXML2::IXMLDOMNodePtr& pIDomNode)
{
IXMLDOMNode* pIDOMChildNode;
LONG lCount;
CComBSTR bstrNodeName;
CComVariant NodeValue;
CString omstrTemp;
CSignalCondition ouSignalCondition;
IXMLDOMNamedNodeMapPtr pIDOMAttributes;
pIDOMAttributes = pIDomNode->Getattributes();// get_attributes((IXMLDOMNamedNodeMap**)&pIDOMAttributes);
//Retrieving Message ID
bstrNodeName = def_STR_TCATTRIB_ID;
pIDOMAttributes->getNamedItem(bstrNodeName, &pIDOMChildNode);
pIDOMChildNode->get_nodeTypedValue(&NodeValue);
omstrTemp = strCopyBSTRToCString(NodeValue);
m_ouData.m_dwMessageID = atoi((LPCSTR)omstrTemp);
m_ouData.m_omMessageName = omstrTemp;
if(m_ouDataBaseManager.bIsValidMessageID(m_ouData.m_dwMessageID)== FALSE)
{
//TODO::INVALID MSG POSSIBLE ONLY WHEN THE FILE IS EDITED WITH NOTEPAD.
return -1;
}
pIDOMChildNode->Release();
//Retrieving Message UNIT
bstrNodeName = _(def_STR_TCATTRIB_UNIT);
pIDOMAttributes->getNamedItem(bstrNodeName, &pIDOMChildNode);
pIDOMChildNode->get_nodeTypedValue(&NodeValue);
omstrTemp = strCopyBSTRToCString(NodeValue);
if(omstrTemp == "RAW")
{
m_ouData.m_eSignalUnitType = RAW;
}
else // else if(omstrTemp == "ENG")
{
m_ouData.m_eSignalUnitType = ENG;
}
pIDOMChildNode->Release();
//Retrieving Message Channel
bstrNodeName = def_STR_TCATTRIB_CHANNEL;
pIDOMAttributes->getNamedItem(bstrNodeName, &pIDOMChildNode);
m_ouData.m_byChannelNumber = 0; // set default-value for the case, the number is incorrect or the whole argument is missing
if (NULL != pIDOMChildNode) // avoid crash in case XML-file -without channel-information- is loaded
{
pIDOMChildNode->get_nodeTypedValue(&NodeValue);
omstrTemp = strCopyBSTRToCString(NodeValue);
m_ouData.m_byChannelNumber = atoi((LPCSTR)omstrTemp);
pIDOMChildNode->Release();
}
if(m_ouData.m_byChannelNumber == 0) // if casting fails (failure in xml)
{
m_ouData.m_byChannelNumber = 1; // set default channel */
m_lDefaultChannelUsed = 1;
}
//Retrieving Signals and their Data
IFrame* sMsg;
IXMLDOMNodeListPtr pIDOMSignalList;
IXMLDOMNode* pIDOMSChildSignal;
bstrNodeName = _(def_STR_SIGNAL_NODE);
pIDOMSignalList = pIDomNode->selectNodes((_bstr_t)bstrNodeName);
pIDOMSignalList->get_length(&lCount);
INT nRetVal;
nRetVal = m_ouDataBaseManager.nGetMessageName(m_ouData.m_dwMessageID, m_ouData.m_omMessageName);
if(nRetVal != S_OK)
{
return nRetVal;
}
nRetVal = m_ouDataBaseManager.nGetMessageInfo(m_ouData.m_omMessageName, &sMsg);
if ( sMsg == nullptr )
{
return nRetVal;
}
UINT unSignalCount = sMsg->GetSignalCount();
//W4 Removal - Local variable not required
//UINT unTSSignalCount = lCount;
std::map<ISignal*, SignalInstanse> signalList;
sMsg->GetSignalList( signalList);
std::string signalName;
for (auto signal : signalList )
//for(UINT i = 0; i < unSignalCount; i++)
//.........这里部分代码省略.........