本文整理汇总了C++中msxml2::IXMLDOMElementPtr::get_childNodes方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMElementPtr::get_childNodes方法的具体用法?C++ IXMLDOMElementPtr::get_childNodes怎么用?C++ IXMLDOMElementPtr::get_childNodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msxml2::IXMLDOMElementPtr
的用法示例。
在下文中一共展示了IXMLDOMElementPtr::get_childNodes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readObject
BOOL WXmlParse::readObject(std::vector<ExternalObject *> &objTree)
{
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(3, &xmlNode);
xmlNode->get_childNodes(&subElementNodes);
subElementNodes->get_length(&subLength);
for (int j = 0; j < subLength;j++)
{
ExternalObject *objTmp = new ExternalObject();
subElementNodes->get_item(j, &xmlSubNode);//获得某个属性
xmlSubNode->get_attributes(&elementAttributes);
readObject(objTmp, xmlSubNode);
objTree.push_back(objTmp);
}
return TRUE;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}