Example #1
0
func ParseString(data string) (*Feed, error) {
	parser := C.feed_parser_new()
	defer C.feed_parser_free(parser)

	feed := C.feed_parser_parse_string(parser, C.CString(data), C.int(len(data)))
	if feed == nil {
		return nil, Error(C.GoString(C.feed_parser_get_error(parser)))
	}
	defer C.feed_free(feed)
	return parseFeed(feed), nil
}
Example #2
0
func ParseFile(file string) (*Feed, error) {
	parser := C.feed_parser_new()
	defer C.feed_parser_free(parser)

	feed := C.feed_parser_parse_file(parser, C.CString(file))
	if feed == nil {
		return nil, Error(C.GoString(C.feed_parser_get_error(parser)))
	}
	defer C.feed_free(feed)
	return parseFeed(feed), nil
}