Пример #1
0
static sixtp*
get_parser1_1_parser2(void)
{
    sixtp *ret;
    sixtp *foobarer;

    ret = simple_parser();
    foobarer = simple_parser();

    sixtp_add_sub_parser(ret, "foobar", foobarer);
    sixtp_add_sub_parser(foobarer, "blah",
                         sixtp_dom_parser_new(print_dom_tree, NULL, NULL));
    sixtp_add_sub_parser(foobarer, "you",
                         sixtp_dom_parser_new(print_dom_tree, NULL, NULL));
    return ret;
}
static sixtp*
gnc_pricedb_parser_new(void)
{
    sixtp *top_level;
    sixtp *price_parser;

    top_level =
        sixtp_set_any(sixtp_new(), TRUE,
                      SIXTP_START_HANDLER_ID, pricedb_start_handler,
                      SIXTP_AFTER_CHILD_HANDLER_ID, pricedb_after_child_handler,
                      SIXTP_CHARACTERS_HANDLER_ID,
                      allow_and_ignore_only_whitespace,
                      SIXTP_RESULT_FAIL_ID, pricedb_cleanup_result_handler,
                      SIXTP_CLEANUP_RESULT_ID, pricedb_cleanup_result_handler,
                      SIXTP_NO_MORE_HANDLERS);

    if (!top_level) return NULL;

    price_parser = gnc_price_parser_new();

    if (!price_parser)
    {
        sixtp_destroy(top_level);
        return NULL;
    }

    sixtp_add_sub_parser(top_level, "price", price_parser);

    return top_level;
}
Пример #3
0
static sixtp*
get_parser1_1_parser1(void)
{
    sixtp *ret;

    ret = sixtp_new();
    g_return_val_if_fail(ret, NULL);
    sixtp_set_chars(ret, allow_and_ignore_only_whitespace);

    sixtp_add_sub_parser(ret, "foobar",
                         sixtp_dom_parser_new(print_dom_tree, NULL, NULL));

    return ret;
}