![]() |
![]() |
![]() |
![]() |
<GMarkupParseContext>
A parse context is used to parse a stream of bytes that you expect to contain marked-up text.
See g_markup_parse_context_new()
, GMarkupParser, and so
on for more details.
(define-values (%return) (markup-parse-context:end-parse? self))
Signals to the GMarkupParseContext that all data has been
fed into the parse context with g_markup_parse_context_parse()
.
This function reports an error if the document isn't complete, for example if elements are still open.
(define-values () (markup-parse-context:free self))
Frees a GMarkupParseContext.
This function can't be called from inside one of the GMarkupParser functions or while a subparser is pushed.
(define-values (%return) (markup-parse-context:get-element self))
Retrieves the name of the currently open element.
If called from the start_element or end_element handlers this will
give the element_name as passed to those functions. For the parent
elements, see g_markup_parse_context_get_element_stack()
.
(define-values (line-number char-number) (markup-parse-context:get-position self))
Retrieves the current line number and the number of the character on that line. Intended for use in error messages; there are no strict semantics for what constitutes the "current" line number other than "the best number we could come up with for error messages."
(define-values (%return) (markup-parse-context:get-user-data self))
Returns the user_data associated with context
.
This will either be the user_data that was provided to
g_markup_parse_context_new()
or to the most recent call
of g_markup_parse_context_push()
.
(define-values (%return) (markup-parse-context:parse? self text text-len))
Feed some data to the GMarkupParseContext.
The data need not be valid UTF-8; an error will be signaled if it's invalid. The data need not be an entire document; you can feed a document into the parser incrementally, via multiple calls to this function. Typically, as you receive data from a network connection or file, you feed each received chunk of data into this function, aborting the process if an error occurs. Once an error is reported, no further data may be fed to the GMarkupParseContext; all errors are fatal.
(define-values (%return) (markup-parse-context:pop self))
Completes the process of a temporary sub-parser redirection.
This function exists to collect the user_data allocated by a
matching call to g_markup_parse_context_push()
. It must be called
in the end_element handler corresponding to the start_element
handler during which g_markup_parse_context_push()
was called.
You must not call this function from the error callback -- the
user_data
is provided directly to the callback in that case.
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.