本文整理汇总了C++中IXMLDOMNodeListPtr::Getlength方法的典型用法代码示例。如果您正苦于以下问题:C++ IXMLDOMNodeListPtr::Getlength方法的具体用法?C++ IXMLDOMNodeListPtr::Getlength怎么用?C++ IXMLDOMNodeListPtr::Getlength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IXMLDOMNodeListPtr
的用法示例。
在下文中一共展示了IXMLDOMNodeListPtr::Getlength方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessRSSItem
void ProcessRSSItem(RSSFeed* f)
{
CoInitializeEx(0, COINIT_APARTMENTTHREADED);
try
{
IXMLDOMDocumentPtr ptr("Microsoft.FreeThreadedXMLDOM");
ptr->async = VARIANT_FALSE;
ptr->validateOnParse = VARIANT_FALSE;
ptr->load(f->link);
if (ptr != 0)
{
IXMLDOMNodeListPtr nodes = ptr->selectNodes(_bstr_t("/rss/channel/item"));
if (nodes != 0)
{
int nItems = nodes->Getlength();
// printf("%d headlines\n", nItems);
for (int i = 0; i < nItems; i++)
{
_bstr_t xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n";
xml += "<rss version=\"0.92\">\n";
xml += "<channel>\n";
xml += "<item>\n";
IXMLDOMNodePtr node = nodes->Getitem(i);
_bstr_t title = GetPathValue(node, _bstr_t("title"));
xml += "<title>";
xml += title;
xml += "</title>\n";
_bstr_t link = GetPathValue(node, _bstr_t("link"));
xml += "<link>";
xml += link;
xml += "</link>\n";
_bstr_t description = GetPathValue(node, _bstr_t("description"));
xml += "<description>";
xml += description;
xml += "</description>\n";
xml += "</item>\n";
xml += "</channel>\n";
xml += "</rss>\n";
Message m;
m.Set("do_method", "notify");
m.Set("kn_to", "/headlines");
m.Set("title", (const char*)title);
m.Set("link", (const char*)link);
m.Set("description", (const char*)description);
m.Set("kn_payload", (const char*)xml);
m.Set("kn_id", (const char*)ConvertLinkToId(link));
m.Set("source_title", (const char*)f->title);
m.Set("source_link", (const char*)f->link);
m.Set("source_description", (const char*)f->description);
m.Set("displayname", "RSS");
m.Set("rss_source", (const char*)f->title);
m.Set("rss_link", (const char*)link);
m.Set("rss_title", (const char*)title);
m.Set("rss_description", (const char*)description);
g_Conn.Publish(m, 0);
// printf("%d: %s <%s>\n", i, (const char*)title, (const char*)link);
}
}
}
}
catch (...)
{
}
CoUninitialize();
}