Bir süredir rss ve atom işleyebilecek bir kütüphane arıyordum. raptor dan başkasını bulamadım desem yeridir.
Basit bir işleç (o ne ki!?) de yazdım. Sırf eğlence olsun diye. Gerçi sırtımdan ter damlarken pek eğlenceli olmadı ![]()
bir de şu ilgimi çekti; google resim önerisine mi başladı ne?
#include <raptor.h>
static void statehandler(void *data, const raptor_statement *statement) {
unsigned char *triple[3];
int i;
triple[0] = raptor_statement_part_as_string(statement->subject,
statement->subject_type,
NULL,
NULL);
triple[0] = raptor_statement_part_as_string(statement->predicate,
statement->predicate_type,
NULL,
NULL);
triple[0] = raptor_statement_part_as_string(statement->object,
statement->object_type,
statement->object_literal_datatype,
statement->object_literal_language);
for (i=0;i<3;i++)
printf("%s", triple[i]);
printf("\n");
}
int main() {
raptor_statement *rstatement = NULL;
raptor_init();
raptor_parser *p=raptor_new_parser("rss-tag-soup");
raptor_set_statement_handler(p, NULL, statehandler);
raptor_uri* file_uri;
file_uri = raptor_new_uri((const unsigned char *) "http://gezegen.linux.org.tr/rss20.xml");
raptor_parse_uri(p, file_uri, NULL);
raptor_free_parser(p);
raptor_free_uri(file_uri);
raptor_finish();
return 0;
}