Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/docs/reference/c/fitz/xml.md @ 3:2c135c81b16c
MERGE: upstream PyMuPDF 1.26.4 with MuPDF 1.26.7
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:44:09 +0200 |
| parents | b50eed0cc0ef |
| children |
comparison
equal
deleted
inserted
replaced
| 0:6015a75abc2d | 3:2c135c81b16c |
|---|---|
| 1 # XML Parser | |
| 2 | |
| 3 We have a rudimentary XML parser that handles well formed XML. It does not do | |
| 4 any namespace processing, and it does not validate the XML syntax. | |
| 5 | |
| 6 The parser supports `UTF-8`, `UTF-16`, `iso-8859-1`, `iso-8859-7`, `koi8`, | |
| 7 `windows-1250`, `windows-1251`, and `windows-1252` encoded input. | |
| 8 | |
| 9 If `preserve_white` is *false*, we will discard all *whitespace-only* text | |
| 10 elements. This is useful for parsing non-text documents such as XPS and SVG. | |
| 11 Preserving whitespace is useful for parsing XHTML. | |
| 12 | |
| 13 typedef struct { opaque } fz_xml_doc; | |
| 14 typedef struct { opaque } fz_xml; | |
| 15 | |
| 16 fz_xml_doc *fz_parse_xml(fz_context *ctx, fz_buffer *buf, int preserve_white); | |
| 17 void fz_drop_xml(fz_context *ctx, fz_xml_doc *xml); | |
| 18 fz_xml *fz_xml_root(fz_xml_doc *xml); | |
| 19 | |
| 20 fz_xml *fz_xml_prev(fz_xml *item); | |
| 21 fz_xml *fz_xml_next(fz_xml *item); | |
| 22 fz_xml *fz_xml_up(fz_xml *item); | |
| 23 fz_xml *fz_xml_down(fz_xml *item); | |
| 24 | |
| 25 `int fz_xml_is_tag(fz_xml *item, const char *name);` | |
| 26 : Returns *true* if the element is a tag with the given name. | |
| 27 | |
| 28 `char *fz_xml_tag(fz_xml *item);` | |
| 29 : Returns the tag name if the element is a tag, otherwise `NULL`. | |
| 30 | |
| 31 `char *fz_xml_att(fz_xml *item, const char *att);` | |
| 32 : Returns the value of the tag element's attribute, or `NULL` if not a tag or missing. | |
| 33 | |
| 34 `char *fz_xml_text(fz_xml *item);` | |
| 35 : Returns the `UTF-8` text of the text element, or `NULL` if not a text element. | |
| 36 | |
| 37 `fz_xml *fz_xml_find(fz_xml *item, const char *tag);` | |
| 38 : Find the next element with the given tag name. Returns the element | |
| 39 itself if it matches, or the first sibling if it doesn't. Returns | |
| 40 `NULL` if there is no sibling with that tag name. | |
| 41 | |
| 42 `fz_xml *fz_xml_find_next(fz_xml *item, const char *tag);` | |
| 43 : Find the next sibling element with the given tag name, or `NULL` if none. | |
| 44 | |
| 45 `fz_xml *fz_xml_find_down(fz_xml *item, const char *tag);` | |
| 46 : Find the first child element with the given tag name, or `NULL` if none. |
