本文整理汇总了C++中Content::Text方法的典型用法代码示例。如果您正苦于以下问题:C++ Content::Text方法的具体用法?C++ Content::Text怎么用?C++ Content::Text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Content
的用法示例。
在下文中一共展示了Content::Text方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExtractItemNodeDetails
void RSSParser::ExtractItemNodeDetails(Item *item, xmlNode *node) {
while (node != NULL) {
// if (node->ns == NULL) {
// printf("%s: %s (NS: NONE)\n", node->name, kNodeNames[node->type]);
// } else {
// printf("%s: %s (NS: %s / %s)\n", node->name, kNodeNames[node->type],
// node->ns->prefix, node->ns->href);
// };
if (node->type == XML_ELEMENT_NODE) {
if (xmlStrcmp(node->name, (const xmlChar *)"title") == 0) {
item->Title(strdup(NodeContents(node).String()));
};
if (xmlStrcmp(node->name, (const xmlChar *)"description") == 0) {
Content *content = new Content();
content->Text(NodeContents(node).String());
item->AddContent(content);
// item->Description(NodeContents(node).String());
};
if (xmlStrcmp(node->name, (const xmlChar *)"link") == 0) {
item->Link(NodeContents(node).String());
};
if (xmlStrcmp(node->name, (const xmlChar *)"guid") == 0) {
item->GUID(NodeContents(node).String());
bool perma = false;
xmlChar *permaStr = xmlGetProp(node, (const xmlChar *)"isPermaLink");
if (xmlStrcmp(permaStr, (const xmlChar *)"true") == 0) perma = true;
item->IsGUIDPermaLink(perma);
};
if (xmlStrcmp(node->name, (const xmlChar *)"author") == 0) {
item->Author(NodeContents(node).String());
};
if (xmlStrcmp(node->name, (const xmlChar *)"category") == 0) {
item->Category(NodeContents(node).String());
};
if (xmlStrcmp(node->name, (const xmlChar *)"pubDate") == 0) {
item->Date(parsedate(NodeContents(node).String(), -1));
};
if (xmlStrcmp(node->name, (const xmlChar *)"comments") == 0) {
item->Comments(NodeContents(node).String());
};
if (xmlStrcmp(node->name, (const xmlChar *)"enclosure") == 0) {
const char *url = (const char *)xmlGetProp(node, (const xmlChar *)"url");
const char *mime = (const char *)xmlGetProp(node, (const xmlChar *)"type");
int32 size = atol((const char *)xmlGetProp(node, (const xmlChar *)"length"));
item->AddEnclosure(new Enclosure((char *)url, (char *)mime, NULL, size));
};
if (xmlStrcmp(node->name, (const xmlChar *)"source") == 0) {
item->SourceURL((const char *)xmlGetProp(node, (const xmlChar *)"url"));
item->SourceTitle(NodeContents(node).String());
};
if (xmlStrcmp(node->name, (const xmlChar *)"content") == 0) {
xmlNs *ns = node->ns;
if ((ns != NULL) && (xmlStrcmp(ns->href, kMediaURI) == 0)) {
Enclosure *enclosure = ExtractMediaContent(node);
if (enclosure) item->AddEnclosure(enclosure);
};
};
if (xmlStrcmp(node->name, (const xmlChar *)"group") == 0) {
xmlNs *ns = node->ns;
if ((ns != NULL) && (xmlStrcmp(ns->href, kMediaURI) == 0)) {
xmlNode *group = node->children;
while (group != NULL) {
Enclosure *enclosure = ExtractMediaContent(group);
if (enclosure) item->AddEnclosure(enclosure);
group = group->next;
};
};
};
};
node = node->next;
};
};