Simple XML Subset Parser

G-Golf GLib Simple XML Subset Parser low level API.
Simple XML Subset Parser — parses a subset of XML

Procedures

g-markup-escape-text

Description

The ‘GMarkup’ parser is intended to parse a simple markup format that’s a subset of XML. This is a small, efficient, easy-to-use parser. It should not be used if you expect to interoperate with other applications generating full-scale XML. However, it’s very useful for application data files, config files, etc. where you know your application will be the only one writing the file. Full-scale XML parsers should be able to parse the subset used by GMarkup, so you can easily migrate to full-scale XML at a later time if the need arises.

GMarkup is not guaranteed to signal an error on all invalid XML; the parser may accept documents that an XML parser would not. However, XML documents which are not well-formed are not considered valid GMarkup documents.

Please read the Simple XML Subset Parser section from the GLib reference manual for a complete description.

Procedures

Procedure: g-markup-escape-text text

Returns a string.

Escapes text, some valid UTF-8 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.

Note that this function doesn’t protect whitespace and line endings from being processed according to the XML rules for normalization of line endings and attribute values.

Returns a newly allocated string with the escaped text.