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; }; };