xine-lib  1.2.9
xmlparser.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2009 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 #ifndef XINE_DEPRECATED
26 #define XINE_DEPRECATED
27 #endif
28 
29 #ifndef XINE_PROTECTED
30 #define XINE_PROTECTED
31 #endif
32 
33 /* parser modes */
34 #define XML_PARSER_CASE_INSENSITIVE 0
35 #define XML_PARSER_CASE_SENSITIVE 1
36 
37 /* return codes */
38 #define XML_PARSER_OK 0
39 #define XML_PARSER_ERROR 1
40 
41 /* xml_parser_build_tree_with_options flag bits */
42 #define XML_PARSER_RELAXED 1
43 #define XML_PARSER_MULTI_TEXT 2
44 
45 /* node name for extra text chunks */
46 #define CDATA_MARKER "[CDATA]"
47 
48 /* xml property */
49 typedef struct xml_property_s {
50  char *name;
51  char *value;
54 
55 /* xml node */
56 /* .data contains any text which precedes any subtree elements;
57  * subtree elements may also contain only text; if so, name is "[CDATA]".
58  * e.g. <a>b<c />d</a>
59  * node1: .name="a" .data="b" .child=node2 .next=NULL
60  * node2: .name="c" .data=NULL .child=NULL .next=node3
61  * node3: .name="[CDATA]" .data="d" .child=NULL .next=NULL
62  * Adjacent text items are merged.
63  */
64 typedef struct xml_node_s {
65  char *name;
66  char *data;
68  struct xml_node_s *child;
69  struct xml_node_s *next;
70 } xml_node_t;
71 
72 /* xml parser */
73 typedef struct xml_parser_s {
74  struct lexer *lexer;
75  int mode;
76 } xml_parser_t;
77 
78 void xml_parser_init(const char * buf, int size, int mode) XINE_DEPRECATED XINE_PROTECTED;
79 xml_parser_t *xml_parser_init_r(const char * buf, int size, int mode) XINE_PROTECTED;
81 
84 
86 int xml_parser_build_tree_with_options_r(xml_parser_t *xml_parser, xml_node_t **root_node, int flags) XINE_PROTECTED;
87 
89 
90 const char *xml_parser_get_property (const xml_node_t *node, const char *name) XINE_PROTECTED;
91 int xml_parser_get_property_int (const xml_node_t *node, const char *name,
92  int def_value) XINE_PROTECTED;
93 int xml_parser_get_property_bool (const xml_node_t *node, const char *name,
94  int def_value) XINE_PROTECTED;
95 
96 /* for output:
97  * returns an escaped string (free() it when done)
98  * input must be in ASCII or UTF-8
99  */
100 
101 typedef enum {
106 char *xml_escape_string (const char *s, xml_escape_quote_t quote_type) XINE_PROTECTED;
107 
108 /* for debugging purposes: dump read-in xml tree in a nicely
109  * indented fashion
110  */
111 
113 
114 #endif
Definition: xmlparser.h:104
void xml_parser_free_tree(xml_node_t *root_node)
Definition: xmlparser.c:179
char * value
Definition: xmlparser.h:51
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
int xml_parser_build_tree(xml_node_t **root_node)
Definition: xmlparser.c:753
Definition: xmllexer.h:59
struct xml_property_s * props
Definition: xmlparser.h:67
int mode
Definition: xmlparser.h:75
struct xml_node_s xml_node_t
int xml_parser_get_property_bool(const xml_node_t *node, const char *name, int def_value)
Definition: xmlparser.c:798
const char * xml_parser_get_property(const xml_node_t *node, const char *name)
Definition: xmlparser.c:761
int xml_parser_build_tree_with_options_r(xml_parser_t *xml_parser, xml_node_t **root_node, int flags)
Definition: xmlparser.c:704
char * name
Definition: xmlparser.h:65
char * xml_escape_string(const char *s, xml_escape_quote_t quote_type)
Definition: xmlparser.c:839
xml_escape_quote_t
Definition: xmlparser.h:101
xml_parser_t * xml_parser_init_r(const char *buf, int size, int mode)
Definition: xmlparser.c:116
void xml_parser_init(const char *buf, int size, int mode)
Definition: xmlparser.c:109
int xml_parser_build_tree_r(xml_parser_t *xml_parser, xml_node_t **root_node)
Definition: xmlparser.c:757
int xml_parser_get_property_int(const xml_node_t *node, const char *name, int def_value)
Definition: xmlparser.c:781
void xml_parser_finalize_r(xml_parser_t *xml_parser)
Definition: xmlparser.c:134
void xml_parser_dump_tree(const xml_node_t *node)
Definition: xmlparser.c:878
struct xml_property_s xml_property_t
struct xml_node_s * next
Definition: xmlparser.h:69
struct xml_node_s * child
Definition: xmlparser.h:68
const char * name
Definition: asfheader.h:137
char * data
Definition: xmlparser.h:66
#define XINE_PROTECTED
Definition: attributes.h:73
char * name
Definition: xmlparser.h:50
Definition: xmlparser.h:103
Definition: xmlparser.h:102
Definition: xmlparser.h:73
struct xml_parser_s xml_parser_t
Definition: xmlparser.h:64
struct xml_property_s * next
Definition: xmlparser.h:52
Definition: xmlparser.h:49
struct lexer * lexer
Definition: xmlparser.h:74
int xml_parser_build_tree_with_options(xml_node_t **root_node, int flags)
Definition: xmlparser.c:700
#define XINE_DEPRECATED
Definition: xmlparser.h:26