glibmm
2.52.1
|
The Glib::Markup parser is intended to parse a simple markup format that's a subset of XML. More...
Classes | |
class | Glib::MarkupError |
Exception class for markup parsing errors. More... | |
class | Glib::Markup::AttributeKeyLess |
Binary predicate used by Markup::Parser::AttributeMap. More... | |
class | Glib::Markup::Parser |
The abstract markup parser base class. More... | |
class | Glib::Markup::ParseContext |
A parse context is used to parse marked-up documents. More... | |
Typedefs | |
using | Glib::Markup::Error = Glib::MarkupError |
Enumerations | |
enum | Glib::MarkupError::Code { Glib::MarkupError::BAD_UTF8, Glib::MarkupError::EMPTY, Glib::MarkupError::PARSE, Glib::MarkupError::UNKNOWN_ELEMENT, Glib::MarkupError::UNKNOWN_ATTRIBUTE, Glib::MarkupError::INVALID_CONTENT, Glib::MarkupError::MISSING_ATTRIBUTE } |
Error codes returned by markup parsing. More... | |
Functions | |
Glib::ustring | Glib::Markup::escape_text (const Glib::ustring& text) |
Escapes text so that the markup parser will parse it verbatim. More... | |
The Glib::Markup 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 Glib::Markup parser, so you can easily migrate to full-scale XML at a later time if the need arises.
Glib::Markup is not guaranteed to signal an error on all invalid XML; the parser may accept documents that an XML parser would not. However, invalid XML documents are not considered valid Glib::Markup documents.
& < > " '
CDATA
using Glib::Markup::Error = typedef Glib::MarkupError |
Error codes returned by markup parsing.
Enumerator | |
---|---|
BAD_UTF8 |
Text being parsed was not valid UTF-8. Text being parsed was not valid UTF-8. |
EMPTY |
Document contained nothing, or only whitespace. Document contained nothing, or only whitespace. |
PARSE |
Document was ill-formed. Document was ill-formed. |
UNKNOWN_ELEMENT |
Error should be set by MarkupParser functions; element wasn't known. This error should be set by Glib::Markup::Parser virtual methods; element wasn't known. |
UNKNOWN_ATTRIBUTE |
Error should be set by MarkupParser functions; attribute wasn't known. This error should be set by Glib::Markup::Parser virtual methods; attribute wasn't known. |
INVALID_CONTENT |
Error should be set by MarkupParser functions; content was invalid. This error should be set by Glib::Markup::Parser virtual methods; something was wrong with contents of the document, e.g. invalid attribute value. |
MISSING_ATTRIBUTE |
Error should be set by MarkupParser functions; a required attribute was missing. |
Glib::ustring Glib::Markup::escape_text | ( | const Glib::ustring& | text | ) |
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.
text | Some valid UTF-8 text. |