本文整理汇总了C++中msxml2::IXMLDOMNamedNodeMapPtr::Getlength方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMNamedNodeMapPtr::Getlength方法的具体用法?C++ IXMLDOMNamedNodeMapPtr::Getlength怎么用?C++ IXMLDOMNamedNodeMapPtr::Getlength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msxml2::IXMLDOMNamedNodeMapPtr
的用法示例。
在下文中一共展示了IXMLDOMNamedNodeMapPtr::Getlength方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: hasAttributes
bool XMLElement::hasAttributes() const {
bool found = false;
MSXML2::IXMLDOMNamedNodeMapPtr attrs;
if (nodePtr) {
if ((nodePtr->get_attributes(&attrs)) == S_OK) {
if (attrs->Getlength() > 0) found = true;
}
}
return found;
}
示例3: NumAttributes
int CXmlNodeWrapper::NumAttributes()
{
if (IsValid())
{
MSXML2::IXMLDOMNamedNodeMapPtr attribs = m_xmlnode->Getattributes();
if (attribs)
return attribs->Getlength();
}
return 0;
}
示例4: getFirstAttribute
XMLAttribute XMLElement::getFirstAttribute() const {
XMLAttribute attr;
MSXML2::IXMLDOMNamedNodeMapPtr attrs;
if (nodePtr) {
if ((nodePtr->get_attributes(&attrs)) == S_OK) {
if (attrs->Getlength() > 0) {
attr.attrPtr = attrs->Getitem(0);
}
}
}
return attr;
}
示例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: _parseNodeGetAttributes
void XmlParser::_parseNodeGetAttributes(MSXML2::IXMLDOMNode *pIDOMNode, XmlNode& node)
{
MSXML2::IXMLDOMNamedNodeMapPtr attributes = pIDOMNode->attributes;
BSTR attrName;
for (int i = 0; i < attributes->Getlength(); i++)
{
MSXML2::IXMLDOMNodePtr atrr = attributes->Getitem(i);
atrr->get_nodeName(&attrName);
_variant_t val = atrr->GetnodeValue();
wstring name(attrName);
BSTR b = val.bstrVal;
wstring value(b);
XmlAttribute attribute(name, value);
node.AddAttribute(attribute);
}
}
示例7: 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;
}