mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-24 21:16:15 +01:00
docs: Move the GMarkup SECTION
Move the content to the new markup.md file. Helps: #3037
This commit is contained in:
parent
3d55be0b82
commit
8b9c4cfb87
@ -62,6 +62,7 @@ content_files = [
|
|||||||
"reference-counting.md",
|
"reference-counting.md",
|
||||||
"testing.md",
|
"testing.md",
|
||||||
"threads.md",
|
"threads.md",
|
||||||
|
"markup.md",
|
||||||
]
|
]
|
||||||
content_images = [
|
content_images = [
|
||||||
"file-name-encodings.png",
|
"file-name-encodings.png",
|
||||||
|
50
docs/reference/glib/markup.md
Normal file
50
docs/reference/glib/markup.md
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
Title: Simple XML Subset Parser
|
||||||
|
SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
SPDX-FileCopyrightText: 2011, 2014 Matthias Clasen
|
||||||
|
SPDX-FileCopyrightText: 2012 David King
|
||||||
|
|
||||||
|
# Simple XML Subset Parser
|
||||||
|
|
||||||
|
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, and must not be used if you
|
||||||
|
expect to parse untrusted input. 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 (which is a
|
||||||
|
weaker condition than being valid. See the
|
||||||
|
[XML specification](http://www.w3.org/TR/REC-xml/)
|
||||||
|
for definitions of these terms.) are not considered valid GMarkup
|
||||||
|
documents.
|
||||||
|
|
||||||
|
## Simplifications to XML
|
||||||
|
|
||||||
|
The simplifications compared to full XML include:
|
||||||
|
|
||||||
|
- Only UTF-8 encoding is allowed
|
||||||
|
- No user-defined entities
|
||||||
|
- Processing instructions, comments and the doctype declaration
|
||||||
|
are "passed through" but are not interpreted in any way
|
||||||
|
- No DTD or validation
|
||||||
|
|
||||||
|
The markup format does support:
|
||||||
|
|
||||||
|
- Elements
|
||||||
|
- Attributes
|
||||||
|
- 5 standard entities: `&` `<` `>` `"` `'`
|
||||||
|
- Character references
|
||||||
|
- Sections marked as CDATA
|
||||||
|
|
||||||
|
## An example parser
|
||||||
|
|
||||||
|
Here is an example for a markup parser:
|
||||||
|
[markup-example.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/glib/tests/markup-example.c)
|
||||||
|
|
@ -160,6 +160,7 @@ expand_content_files = [
|
|||||||
'running.md',
|
'running.md',
|
||||||
'testing.md',
|
'testing.md',
|
||||||
'threads.md',
|
'threads.md',
|
||||||
|
'markup.md',
|
||||||
]
|
]
|
||||||
|
|
||||||
glib_gir = meson.current_source_dir() / 'GLib-2.0.gir'
|
glib_gir = meson.current_source_dir() / 'GLib-2.0.gir'
|
||||||
|
@ -38,60 +38,6 @@
|
|||||||
#include "glibintl.h"
|
#include "glibintl.h"
|
||||||
#include "gthread.h"
|
#include "gthread.h"
|
||||||
|
|
||||||
/**
|
|
||||||
* SECTION:markup
|
|
||||||
* @Title: Simple XML Subset Parser
|
|
||||||
* @Short_description: parses a subset of XML
|
|
||||||
* @See_also: [XML Specification](http://www.w3.org/TR/REC-xml/)
|
|
||||||
*
|
|
||||||
* 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, and must not be used if you
|
|
||||||
* expect to parse untrusted input. 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 (which is a
|
|
||||||
* weaker condition than being valid. See the
|
|
||||||
* [XML specification](http://www.w3.org/TR/REC-xml/)
|
|
||||||
* for definitions of these terms.) are not considered valid GMarkup
|
|
||||||
* documents.
|
|
||||||
*
|
|
||||||
* Simplifications to XML include:
|
|
||||||
*
|
|
||||||
* - Only UTF-8 encoding is allowed
|
|
||||||
*
|
|
||||||
* - No user-defined entities
|
|
||||||
*
|
|
||||||
* - Processing instructions, comments and the doctype declaration
|
|
||||||
* are "passed through" but are not interpreted in any way
|
|
||||||
*
|
|
||||||
* - No DTD or validation
|
|
||||||
*
|
|
||||||
* The markup format does support:
|
|
||||||
*
|
|
||||||
* - Elements
|
|
||||||
*
|
|
||||||
* - Attributes
|
|
||||||
*
|
|
||||||
* - 5 standard entities: & < > " '
|
|
||||||
*
|
|
||||||
* - Character references
|
|
||||||
*
|
|
||||||
* - Sections marked as CDATA
|
|
||||||
|
|
||||||
* ## An example parser # {#example}
|
|
||||||
*
|
|
||||||
* Here is an example for a markup parser:
|
|
||||||
* [markup-example.c](https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/glib/tests/markup-example.c)
|
|
||||||
*/
|
|
||||||
|
|
||||||
G_DEFINE_QUARK (g-markup-error-quark, g_markup_error)
|
G_DEFINE_QUARK (g-markup-error-quark, g_markup_error)
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
Loading…
Reference in New Issue
Block a user