xine-lib: xine-lib-1.2.12/include/xine/xmlparser.h Source File

xine-lib 1.2.12

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 */
43 typedef struct xml_property_s {
44 char *name;
45 char *value;
46 struct xml_property_s *next;
47} xml_property_t;
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 */
58 typedef struct xml_node_s {
59 char *name;
60 char *data;
61 struct xml_property_s *props;
62 struct xml_node_s *child;
63 struct xml_node_s *next;
64} xml_node_t;
65
66/* xml parser */
67 typedef struct xml_parser_s {
68 struct lexer *lexer;
69 int mode;
70} xml_parser_t;
71
72void xml_parser_init(const char * buf, int size, int mode) XINE_DEPRECATED XINE_PROTECTED;
73 xml_parser_t *xml_parser_init_r(const char * buf, int size, int mode) XINE_PROTECTED;
74void xml_parser_finalize_r(xml_parser_t *xml_parser) XINE_PROTECTED;
75
76int xml_parser_build_tree(xml_node_t **root_node) XINE_DEPRECATED XINE_PROTECTED;
77int xml_parser_build_tree_r(xml_parser_t *xml_parser, xml_node_t **root_node) XINE_PROTECTED;
78
79int xml_parser_build_tree_with_options(xml_node_t **root_node, int flags) XINE_DEPRECATED XINE_PROTECTED;
80int xml_parser_build_tree_with_options_r(xml_parser_t *xml_parser, xml_node_t **root_node, int flags) XINE_PROTECTED;
81
82void xml_parser_free_tree(xml_node_t *root_node) XINE_PROTECTED;
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
95 typedef enum {
96 XML_ESCAPE_NO_QUOTE,
97 XML_ESCAPE_SINGLE_QUOTE,
98 XML_ESCAPE_DOUBLE_QUOTE
99} xml_escape_quote_t;
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
106void xml_parser_dump_tree (const xml_node_t *node) XINE_PROTECTED;
107
108#endif
attributes.h
XINE_DEPRECATED
#define XINE_DEPRECATED
Definition: attributes.h:87
XINE_PROTECTED
#define XINE_PROTECTED
Definition: attributes.h:75
lexer
Definition: xmllexer.h:54
xml_node_s
Definition: xmlparser.h:58
xml_node_s::next
struct xml_node_s * next
Definition: xmlparser.h:63
xml_node_s::data
char * data
Definition: xmlparser.h:60
xml_node_s::child
struct xml_node_s * child
Definition: xmlparser.h:62
xml_node_s::props
struct xml_property_s * props
Definition: xmlparser.h:61
xml_node_s::name
char * name
Definition: xmlparser.h:59
xml_parser_s
Definition: xmlparser.h:67
xml_parser_s::lexer
struct lexer * lexer
Definition: xmlparser.h:68
xml_parser_s::mode
int mode
Definition: xmlparser.h:69
xml_property_s
Definition: xmlparser.h:43
xml_property_s::next
struct xml_property_s * next
Definition: xmlparser.h:46
xml_property_s::name
char * name
Definition: xmlparser.h:44
xml_property_s::value
char * value
Definition: xmlparser.h:45
name
const char * name
Definition: xine.c:1569
mode
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
xml_parser_free_tree
void xml_parser_free_tree(xml_node_t *root_node)
Definition: xmlparser.c:175
xml_property_t
struct xml_property_s xml_property_t
xml_parser_get_property_int
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
xml_escape_quote_t
Definition: xmlparser.h:95
XML_ESCAPE_NO_QUOTE
@ XML_ESCAPE_NO_QUOTE
Definition: xmlparser.h:96
XML_ESCAPE_DOUBLE_QUOTE
@ XML_ESCAPE_DOUBLE_QUOTE
Definition: xmlparser.h:98
XML_ESCAPE_SINGLE_QUOTE
@ XML_ESCAPE_SINGLE_QUOTE
Definition: xmlparser.h:97
xml_parser_init
void xml_parser_init(const char *buf, int size, int mode) XINE_DEPRECATED
Definition: xmlparser.c:105
xml_parser_get_property_bool
int xml_parser_get_property_bool(const xml_node_t *node, const char *name, int def_value)
Definition: xmlparser.c:833
xml_parser_build_tree_with_options_r
int xml_parser_build_tree_with_options_r(xml_parser_t *xml_parser, xml_node_t **root_node, int flags)
Definition: xmlparser.c:739
xml_parser_finalize_r
void xml_parser_finalize_r(xml_parser_t *xml_parser)
Definition: xmlparser.c:130
xml_parser_t
struct xml_parser_s xml_parser_t
xml_parser_build_tree
int xml_parser_build_tree(xml_node_t **root_node) XINE_DEPRECATED
Definition: xmlparser.c:788
xml_parser_dump_tree
void xml_parser_dump_tree(const xml_node_t *node)
Definition: xmlparser.c:923
xml_escape_string
char * xml_escape_string(const char *s, xml_escape_quote_t quote_type)
Definition: xmlparser.c:874
xml_parser_init_r
xml_parser_t * xml_parser_init_r(const char *buf, int size, int mode)
Definition: xmlparser.c:112
xml_parser_get_property
const char * xml_parser_get_property(const xml_node_t *node, const char *name)
Definition: xmlparser.c:796
xml_parser_build_tree_r
int xml_parser_build_tree_r(xml_parser_t *xml_parser, xml_node_t **root_node)
Definition: xmlparser.c:792
xml_parser_build_tree_with_options
int xml_parser_build_tree_with_options(xml_node_t **root_node, int flags) XINE_DEPRECATED
Definition: xmlparser.c:735
xml_node_t
struct xml_node_s xml_node_t