Gtk.BuildableParseContext.push

### Method

# Gtk BuildableParseContextpush

#### Declaration [src]

    void
    gtk_buildable_parse_context_push (
      GtkBuildableParseContext* context,
      const GtkBuildableParser* parser,
      gpointer user_data
    )

#### Description [src]

Temporarily redirects markup data to a sub-parser.

This function may only be called from the start_element handler of a `GtkBuildableParser`. It must be matched with a corresponding call to `gtk_buildable_parse_context_pop()` in the matching end_element handler (except in the case that the parser aborts due to an error).

All tags, text and other data between the matching tags is redirected to the subparser given by `parser`. `user_data` is used as the user_data for that parser. `user_data` is also passed to the error callback in the event that an error occurs. This includes errors that occur in subparsers of the subparser.

The end tag matching the start tag for which this call was made is handled by the previous parser (which is given its own user_data) which is why `gtk_buildable_parse_context_pop()` is provided to allow “one last access” to the `user_data` provided to this function. In the case of error, the `user_data` provided here is passed directly to the error callback of the subparser and `gtk_buildable_parse_context_pop()` should not be called. In either case, if `user_data` was allocated then it ought to be freed from both of these locations.

This function is not intended to be directly called by users interested in invoking subparsers. Instead, it is intended to be used by the subparsers themselves to implement a higher-level interface.

For an example of how to use this, see `g_markup_parse_context_push()` which has the same kind of API.

#### Parameters

`parser` | `GtkBuildableParser`
| A `GtkBuildableParser`
| The data is owned by the caller of the function.
`user_data` | `gpointer`
| User data to pass to `GtkBuildableParser` functions.
| The argument can be `NULL`.
| The data is owned by the caller of the function.