本文整理汇总了C++中msxml2::IXMLDOMNamedNodeMapPtr::getNamedItem方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMNamedNodeMapPtr::getNamedItem方法的具体用法?C++ IXMLDOMNamedNodeMapPtr::getNamedItem怎么用?C++ IXMLDOMNamedNodeMapPtr::getNamedItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msxml2::IXMLDOMNamedNodeMapPtr
的用法示例。
在下文中一共展示了IXMLDOMNamedNodeMapPtr::getNamedItem方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readExtendModName
BOOL WXmlParse::readExtendModName(std::vector<std::pair<string, string> > &modNames)
{
MSXML2::IXMLDOMDocumentPtr doc;
MSXML2::IXMLDOMElementPtr docRoot;
MSXML2::IXMLDOMElementPtr docElement;
MSXML2::IXMLDOMNodeListPtr elementNodes;
MSXML2::IXMLDOMNamedNodeMapPtr elementAttributes;
MSXML2::IXMLDOMNodePtr xmlNode;
MSXML2::IXMLDOMNodePtr xmlSubNode;
MSXML2::IXMLDOMNodePtr xmlAttrNode;
doc.CreateInstance(__uuidof(DOMDocument30));
doc->load((_variant_t)m_strFileName);
docRoot = doc->GetdocumentElement();//获得根节点;
docRoot->get_childNodes(&elementNodes);
LONG length, subLength, attrLength;
elementNodes->get_length(&length);
MSXML2::IXMLDOMNodeListPtr subElementNodes;
// 3 : 扩展模块列表
elementNodes->get_item(1, &xmlNode);
xmlNode->get_childNodes(&subElementNodes);
subElementNodes->get_length(&subLength);
for (int j = 0; j < subLength;j++)
{
subElementNodes->get_item(j, &xmlSubNode);//获得某个属性
xmlSubNode->get_attributes(&elementAttributes);
MSXML2::IXMLDOMNodePtr nameNode = elementAttributes->getNamedItem("name");
MSXML2::IXMLDOMNodePtr descNode = elementAttributes->getNamedItem("description");
modNames.push_back(std::make_pair(nameNode->text, descNode->text));
}
return TRUE;
}
示例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: readVerticesNormalsTexcoords
void readVerticesNormalsTexcoords(MSXML2::IXMLDOMNodePtr mesh, geometry_t &geometry)
{
MSXML2::IXMLDOMNodeListPtr sourceList = mesh->selectNodes("r:source");
vector<float> vertices;
vector<float> normals;
vector<float> texcoords;
for (int i = 0; i < sourceList->length; i++)
{
MSXML2::IXMLDOMNodePtr source = sourceList->Getitem(i);
MSXML2::IXMLDOMNamedNodeMapPtr attributes = source->attributes;
for (int j = 0; j < attributes->length; j++)
{
_bstr_t attributeName = attributes->getNamedItem("id")->text;
if (wcsstr(_wcslwr(attributeName), L"position"))
{
geometry.vertices = readArray<float>(source);
} else if (wcsstr(_wcslwr(attributeName), L"normal"))
{
geometry.normals = readArray<float>(source);
} else if (wcsstr(_wcslwr(attributeName), L"map") || // belnder
wcsstr(_wcslwr(attributeName), L"-uv")) // 3dsmax
{
geometry.texcoords = readArray<float>(source);
}
}
}
}
示例5: readObject
BOOL WXmlParse::readObject(ExternalObject *objRet, MSXML2::IXMLDOMNodePtr &xmlSubNode)
{
MSXML2::IXMLDOMNamedNodeMapPtr elementAttributes;
MSXML2::IXMLDOMNodeListPtr subElementNodes;
MSXML2::IXMLDOMNodeListPtr subSubElementNodes;
MSXML2::IXMLDOMNodePtr xmlNodeTmp;
xmlSubNode->get_attributes(&elementAttributes);
LONG attrLength;
attrLength = elementAttributes->Getlength();
MSXML2::IXMLDOMNodePtr nameNode = elementAttributes->getNamedItem("name");
MSXML2::IXMLDOMNodePtr clsNode = elementAttributes->getNamedItem("type");
objRet->objName = nameNode->text;
objRet->clsName = clsNode->text;
LONG length, subLength;
xmlSubNode->get_childNodes(&subElementNodes);
subElementNodes->get_length(&length);
objRet->attri.clear();
for (int i = 0;i < length;i++)
{
subElementNodes->get_item(i, &xmlNodeTmp);
string childName = xmlNodeTmp->nodeName;
if (strcmp(xmlNodeTmp->nodeName,"child") != 0)
{
xmlNodeTmp->get_attributes(&elementAttributes);
if (!elementAttributes)
return FALSE;
MSXML2::IXMLDOMNodePtr typeNode = elementAttributes->getNamedItem("type");
objRet->attri.push_back(std::make_pair(xmlNodeTmp->nodeName, std::make_pair(typeNode->text, xmlNodeTmp->text)));
}
else
{
xmlNodeTmp->get_childNodes(&subSubElementNodes);
subSubElementNodes->get_length(&subLength);
for (int j = 0;j < subLength;j++)
{
ExternalObject *objSub = new ExternalObject();
subSubElementNodes->get_item(j, &xmlNodeTmp);
readObject(objSub, xmlNodeTmp);
objRet->children.push_back(objSub);
}
}
}
return TRUE;
}
示例6: readCalculateParams
BOOL WXmlParse::readCalculateParams(WCalcaulateParam &calParam)
{
MSXML2::IXMLDOMDocumentPtr doc;
MSXML2::IXMLDOMElementPtr docRoot;
MSXML2::IXMLDOMElementPtr docElement;
MSXML2::IXMLDOMNodeListPtr elementNodes;
MSXML2::IXMLDOMNamedNodeMapPtr elementAttributes;
MSXML2::IXMLDOMNodePtr xmlNode;
MSXML2::IXMLDOMNodePtr xmlSubNode;
MSXML2::IXMLDOMNodePtr xmlAttrNode;
doc.CreateInstance(__uuidof(DOMDocument30));
if (m_strFileName.IsEmpty())
{
return FALSE;
}
doc->load((_variant_t)m_strFileName);
docRoot = doc->GetdocumentElement();//获得根节点;
docRoot->get_childNodes(&elementNodes);
LONG length, subLength, attrLength;
elementNodes->get_length(&length);
MSXML2::IXMLDOMNodeListPtr subElementNodes;
// 0 :
elementNodes->get_item(2, &xmlNode);
xmlNode->get_childNodes(&subElementNodes);
subElementNodes->get_length(&subLength);
for (int j = 0; j < subLength;j++)
{
subElementNodes->get_item(j, &xmlSubNode);//获得某个属性
xmlSubNode->get_attributes(&elementAttributes);
MSXML2::IXMLDOMNodePtr proNode = elementAttributes->getNamedItem("name");
string proName = proNode->text;
MSXML2::IXMLDOMNodeListPtr subAttrNodes;
xmlSubNode->get_childNodes(&subAttrNodes);
subAttrNodes->get_length(&attrLength);
// ASSERT(attrLength == 2);
MSXML2::IXMLDOMNodePtr descNode;
MSXML2::IXMLDOMNodePtr stateNode;
subAttrNodes->get_item(0, &descNode);
subAttrNodes->get_item(1, &stateNode);
std::vector<string> vecParam;
string descText = descNode->text;
string stateText = stateNode->text;
vecParam.push_back(proName);
vecParam.push_back(descText);
vecParam.push_back(stateText);
calParam.addParam(vecParam);
}
return TRUE;
}
示例7: 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;
}
示例8: GetStringValue
////////////////////////////////////////////////////////////////////////////
// Helper function:
////////////////////////////////////////////////////////////////////////////
CString CXMLDocument::GetStringValue(LPCSTR szAttrib, MSXML2::IXMLDOMNode* pNode)
{
CComBSTR bstrValue;
MSXML2::IXMLDOMNamedNodeMapPtr pAttributes;
MSXML2::IXMLDOMNodePtr pItemNode;
if (SUCCEEDED(pNode->get_attributes(&pAttributes)) && (pAttributes != NULL))
pAttributes->getNamedItem(CComBSTR(szAttrib), &pItemNode);
if (pItemNode)
pItemNode->get_text(&bstrValue);
return CString(bstrValue);
}
示例9: readTriangles
void readTriangles(MSXML2::IXMLDOMNodePtr mesh, geometry_t &geometry)
{
MSXML2::IXMLDOMNodeListPtr polyLists = mesh->selectNodes("r:polylist"); // blender
MSXML2::IXMLDOMNodePtr p;
if (polyLists->length == 0)
polyLists = mesh->selectNodes("r:triangles"); // 3dsmax
for (int i = 0; i < polyLists->length; i++)
{
MSXML2::IXMLDOMNodePtr polylist = polyLists->item[i];
MSXML2::IXMLDOMNodePtr p = polylist->selectSingleNode("r:p");
if (p == NULL) continue;
geometry.vertexOffset.push_back(-1);
geometry.normalOffset.push_back(-1);
geometry.texcoordOffset.push_back(-1);
MSXML2::IXMLDOMNodeListPtr inputList = polylist->selectNodes("r:input");
for (int j = 0; j < inputList->length; j++)
{
MSXML2::IXMLDOMNodePtr input = inputList->Getitem(j);
MSXML2::IXMLDOMNamedNodeMapPtr attributes = input->attributes;
string semantic = (_bstr_t)_wcslwr((wchar_t *)attributes->getNamedItem("semantic")->text);
int offset = _wtoi(attributes->getNamedItem("offset")->text);
if (semantic == "vertex")
geometry.vertexOffset[geometry.vertexOffset.size() - 1] = offset;
else if (semantic == "normal")
geometry.normalOffset[geometry.normalOffset.size() - 1] = offset;
else if (semantic == "texcoord")
geometry.texcoordOffset[geometry.texcoordOffset.size() - 1] = offset;
}
vector<int> v = readValues<int>(p);
geometry.triangles.push_back(v);
}
}
示例10: readParam
BOOL WXmlParse::readParam(std::vector<WParamDefine *> &outParams)
{
MSXML2::IXMLDOMDocumentPtr doc;
MSXML2::IXMLDOMElementPtr docRoot;
MSXML2::IXMLDOMElementPtr docElement;
MSXML2::IXMLDOMNodeListPtr elementNodes;
MSXML2::IXMLDOMNamedNodeMapPtr elementAttributes;
MSXML2::IXMLDOMNodePtr xmlNode;
MSXML2::IXMLDOMNodePtr xmlSubNode;
MSXML2::IXMLDOMNodePtr xmlAttrNode;
doc.CreateInstance(__uuidof(DOMDocument30));
if (m_strFileName.IsEmpty())
{
return FALSE;
}
doc->load((_variant_t)m_strFileName);
docRoot = doc->GetdocumentElement();//获得根节点;
docRoot->get_childNodes(&elementNodes);
LONG length, subLength, attrLength;
elementNodes->get_length(&length);
MSXML2::IXMLDOMNodeListPtr subElementNodes;
// 0 :
elementNodes->get_item(0, &xmlNode);
xmlNode->get_childNodes(&subElementNodes);
subElementNodes->get_length(&subLength);
for (int j = 0; j < subLength;j++)
{
subElementNodes->get_item(j, &xmlSubNode);//获得某个属性
xmlSubNode->get_attributes(&elementAttributes);
MSXML2::IXMLDOMNodePtr proNode = elementAttributes->getNamedItem("name");
string proName = proNode->text;
WParamDefine *paramTest = new WParamDefine(proName);
MSXML2::IXMLDOMNodeListPtr subAttrNodes;
xmlSubNode->get_childNodes(&subAttrNodes);
subAttrNodes->get_length(&attrLength);
for (int k = 0;k < attrLength;k++)
{
subAttrNodes->get_item(k, &xmlAttrNode);
string attrName = xmlAttrNode->nodeName;
string attrText = xmlAttrNode->text;
paramTest->addValue(attrName, attrText);
}
outParams.push_back(paramTest);
}
return TRUE;
}
示例11: ReadNodeAttribute
bool XmlIOStreamImp::ReadNodeAttribute(const CString& attrName, CString& attrValue)
{
DATA_ASSERT(mpCurrentNode != NULL);
if(NULL == mpCurrentNode)
return false;
MSXML2::IXMLDOMNamedNodeMapPtr attribs = mpCurrentNode->Getattributes();
MSXML2::IXMLDOMNodePtr pAttr = attribs->getNamedItem((LPCTSTR)attrName);
if(NULL == pAttr)
return false;
attrValue = pAttr->GetnodeValue();
return true;
}
示例12: readMesh
void readMesh(dae_reader_t *reader, MSXML2::IXMLDOMNodePtr geometry)
{
MSXML2::IXMLDOMNodePtr mesh = geometry->selectSingleNode("r:mesh");
if (mesh == NULL) return;
geometry_t object;
MSXML2::IXMLDOMNamedNodeMapPtr attributes = geometry->attributes;
if (attributes->length > 0)
object.name = attributes->getNamedItem("name")->text;
readVerticesNormalsTexcoords(mesh, object);
readTriangles(mesh, object);
object.maxIndex = 0;
reader->geometry.push_back(object);
}
示例13: bReadAttribute
bool CNodeUtil::bReadAttribute(MSXML2::IXMLDOMNode* iNode,
std::string& omAttribute, _bstr_t temp)
{
std::string strTemp;
bool bResult = false;
MSXML2::IXMLDOMNamedNodeMapPtr pCodeAttrib;
MSXML2::IXMLDOMNodePtr iTempNode = nullptr;
pCodeAttrib = iNode->Getattributes();
if (pCodeAttrib->Getlength() >= 1)
{
iTempNode = pCodeAttrib->getNamedItem(temp);
if (iTempNode != nullptr)
{
omAttribute = _com_util::ConvertBSTRToString(iTempNode->text.GetBSTR());
bResult = true;
}
}
return bResult;
}
示例14: 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;
}