xine-lib 1.2.13-20230125hg15249
xmlparser.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2002-2018 the xine project
3 *
4 * This file is part of xine, a free video player.
5 *
6 * The xine-lib XML parser is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
10 *
11 * The xine-lib XML parser is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with the Gnome Library; see the file COPYING.LIB. If not,
18 * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
19 * Floor, Boston, MA 02110, USA
20 */
21
22#ifndef XML_PARSER_H
23#define XML_PARSER_H
24
25#include <xine/attributes.h>
26
27/* parser modes */
28#define XML_PARSER_CASE_INSENSITIVE 0
29#define XML_PARSER_CASE_SENSITIVE 1
30
31/* return codes */
32#define XML_PARSER_OK 0
33#define XML_PARSER_ERROR 1
34
35/* xml_parser_build_tree_with_options flag bits */
36#define XML_PARSER_RELAXED 1
37#define XML_PARSER_MULTI_TEXT 2
38
39/* node name for extra text chunks */
40#define CDATA_MARKER "[CDATA]"
41
42/* xml property */
43typedef struct xml_property_s {
44 char *name;
45 char *value;
48
49/* xml node */
50/* .data contains any text which precedes any subtree elements;
51 * subtree elements may also contain only text; if so, name is "[CDATA]".
52 * e.g. <a>b<c />d</a>
53 * node1: .name="a" .data="b" .child=node2 .next=NULL
54 * node2: .name="c" .data=NULL .child=NULL .next=node3
55 * node3: .name="[CDATA]" .data="d" .child=NULL .next=NULL
56 * Adjacent text items are merged.
57 */
58typedef struct xml_node_s {
59 char *name;
60 char *data;
65
66/* xml parser */
67typedef struct xml_parser_s {
68 struct lexer *lexer;
69 int mode;
71
72void xml_parser_init(const char * buf, int size, int mode) XINE_DEPRECATED XINE_PROTECTED;
73xml_parser_t *xml_parser_init_r(const char * buf, int size, int mode) XINE_PROTECTED;
75
78
80int xml_parser_build_tree_with_options_r(xml_parser_t *xml_parser, xml_node_t **root_node, int flags) XINE_PROTECTED;
81
83
84const char *xml_parser_get_property (const xml_node_t *node, const char *name) XINE_PROTECTED;
85int xml_parser_get_property_int (const xml_node_t *node, const char *name,
86 int def_value) XINE_PROTECTED;
87int xml_parser_get_property_bool (const xml_node_t *node, const char *name,
88 int def_value) XINE_PROTECTED;
89
90/* for output:
91 * returns an escaped string (free() it when done)
92 * input must be in ASCII or UTF-8
93 */
94
100char *xml_escape_string (const char *s, xml_escape_quote_t quote_type) XINE_PROTECTED;
101
102/* for debugging purposes: dump read-in xml tree in a nicely
103 * indented fashion
104 */
105
107
108#endif
#define XINE_DEPRECATED
Definition attributes.h:87
#define XINE_PROTECTED
Definition attributes.h:75
Definition xmllexer.h:54
Definition xmlparser.h:58
struct xml_node_s * next
Definition xmlparser.h:63
char * data
Definition xmlparser.h:60
struct xml_node_s * child
Definition xmlparser.h:62
struct xml_property_s * props
Definition xmlparser.h:61
char * name
Definition xmlparser.h:59
Definition xmlparser.h:67
struct lexer * lexer
Definition xmlparser.h:68
int mode
Definition xmlparser.h:69
Definition xmlparser.h:43
struct xml_property_s * next
Definition xmlparser.h:46
char * name
Definition xmlparser.h:44
char * value
Definition xmlparser.h:45
const char * name
Definition xine.c:1575
enable disable number of frames of telecine pattern sync required before mode change make frames evenly spaced for film mode(24 fps)" ) PARAM_ITEM( POST_PARAM_TYPE_BOOL
void xml_parser_free_tree(xml_node_t *root_node)
Definition xmlparser.c:175
struct xml_property_s xml_property_t
int xml_parser_get_property_int(const xml_node_t *node, const char *name, int def_value)
Definition xmlparser.c:816
xml_escape_quote_t
Definition xmlparser.h:95
@ XML_ESCAPE_NO_QUOTE
Definition xmlparser.h:96
@ XML_ESCAPE_DOUBLE_QUOTE
Definition xmlparser.h:98
@ XML_ESCAPE_SINGLE_QUOTE
Definition xmlparser.h:97
void xml_parser_init(const char *buf, int size, int mode) XINE_DEPRECATED
Definition xmlparser.c:105
int xml_parser_get_property_bool(const xml_node_t *node, const char *name, int def_value)
Definition xmlparser.c:833
int xml_parser_build_tree_with_options_r(xml_parser_t *xml_parser, xml_node_t **root_node, int flags)
Definition xmlparser.c:739
void xml_parser_finalize_r(xml_parser_t *xml_parser)
Definition xmlparser.c:130
struct xml_parser_s xml_parser_t
int xml_parser_build_tree(xml_node_t **root_node) XINE_DEPRECATED
Definition xmlparser.c:788
void xml_parser_dump_tree(const xml_node_t *node)
Definition xmlparser.c:923
char * xml_escape_string(const char *s, xml_escape_quote_t quote_type)
Definition xmlparser.c:874
xml_parser_t * xml_parser_init_r(const char *buf, int size, int mode)
Definition xmlparser.c:112
const char * xml_parser_get_property(const xml_node_t *node, const char *name)
Definition xmlparser.c:796
int xml_parser_build_tree_r(xml_parser_t *xml_parser, xml_node_t **root_node)
Definition xmlparser.c:792
int xml_parser_build_tree_with_options(xml_node_t **root_node, int flags) XINE_DEPRECATED
Definition xmlparser.c:735
struct xml_node_s xml_node_t