A parse context is used to parse marked-up documents.
You can feed any number of documents into a context, as long as no errors occur; once an error occurs, the parse context can't continue to parse text (you have to destroy it and create a new parse context).
| void Glib::Markup::ParseContext::get_tag_start |
( |
gsize & |
line_number, |
|
|
gsize & |
char_number, |
|
|
gsize & |
offset |
|
) |
| const |
Retrieves the start position of the current start or end tag.
This function can be used in the start_element or end_element callbacks to obtain location information for error reporting.
Note that line_number and char_number are intended for human readable error messages and are therefore 1-based and in Unicode characters. offset on the other hand is meant for programmatic use, and thus is 0-based and in bytes.
The information is meant to accompany the values returned by get_line_number() and get_char_number(), and comes with the same accuracy guarantees.
- Parameters
-
| [out] | line_number | The line number. |
| [out] | char_number | The character number. |
| [out] | offset | Offset from the beginning of the document. |
- Since glibmm 2.88:
Feed some data to the ParseContext.
The data need not be valid UTF-8; an error will be signalled 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 ParseContext; all errors are fatal.
- Parameters
-
| text_begin | Begin of chunk of text to parse. |
| text_end | End of chunk of text to parse. |
- Exceptions
-
Feed some data to the ParseContext.
The data need not be valid UTF-8; an error will be signalled 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 ParseContext; all errors are fatal.
- Parameters
-
| text | Chunk of text to parse. |
- Exceptions
-