SimpleXML

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.

Constructors

this
this(GMarkupParseContext* gMarkupParseContext, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(GMarkupParser* parser, GMarkupParseFlags flags, void* userData, GDestroyNotify userDataDnotify)

Creates a new parse context. 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 free it and create a new parse context).

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Members

Functions

endParse
bool endParse()

Signals to the GMarkupParseContext that all data has been fed into the parse context with g_markup_parse_context_parse().

free
void free()

Frees a GMarkupParseContext

getElement
string getElement()

Retrieves the name of the currently open element.

getElementStack
ListSG getElementStack()

Retrieves the element stack from the internal state of the parser.

getPosition
void getPosition(int lineNumber, int charNumber)

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."

getSimpleXMLStruct
GMarkupParseContext* getSimpleXMLStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getUserData
void* getUserData()

Returns the user_data associated with context.

parse
bool parse(string text, ptrdiff_t textLen)

Feed some data to the GMarkupParseContext

pop
void* pop()

Completes the process of a temporary sub-parser redirection.

push
void push(GMarkupParser* parser, void* userData)

Temporarily redirects markup data to a sub-parser.

ref_
SimpleXML ref_()

Increases the reference count of context.

unref
void unref()

Decreases the reference count of context. When its reference count drops to 0, it is freed.

Static functions

markupErrorQuark
GQuark markupErrorQuark()
markupEscapeText
string markupEscapeText(string text, ptrdiff_t length)

Escapes text so that the markup parser will parse it verbatim. Less than, greater than, ampersand, etc. are replaced with the corresponding entities. This function would typically be used when writing out a file to be parsed with the markup parser.

markupVprintfEscaped
string markupVprintfEscaped(string format, void* args)

Formats the data in args according to format, escaping all string and character arguments in the fashion of g_markup_escape_text(). See g_markup_printf_escaped().

Variables

gMarkupParseContext
GMarkupParseContext* gMarkupParseContext;

the main Gtk struct