summaryrefslogtreecommitdiff
path: root/src/xine-utils/xmlparser.h
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2007-09-14 20:35:21 +0100
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2007-09-14 20:35:21 +0100
commitd30342f36c093e6fe7a693da437dd15cd1e7075b (patch)
treee204579967a1848d0a88a28bf2508d7315c475e3 /src/xine-utils/xmlparser.h
parent5b1c15d5ffb5509eddd4408e2e4495f1e5e43162 (diff)
downloadxine-lib-d30342f36c093e6fe7a693da437dd15cd1e7075b.tar.gz
xine-lib-d30342f36c093e6fe7a693da437dd15cd1e7075b.tar.bz2
Create child "[CDATA]" nodes for extra text (but prefer merging).
<a>b<[CDATA[c]]></a> gives a.data = "bc". <a>b<d/>c</a> gives a.data = "b" & .child = "d" then "[CDATA]" with .data = "c" if XML_PARSER_MULTI_TEXT is set, else a.data = "bc" and there's no "[CDATA]".
Diffstat (limited to 'src/xine-utils/xmlparser.h')
-rw-r--r--src/xine-utils/xmlparser.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/xine-utils/xmlparser.h b/src/xine-utils/xmlparser.h
index 8d4915abf..364cc4c2b 100644
--- a/src/xine-utils/xmlparser.h
+++ b/src/xine-utils/xmlparser.h
@@ -37,6 +37,12 @@
#define XML_PARSER_OK 0
#define XML_PARSER_ERROR 1
+/* xml_parser_build_tree_with_options flag bits */
+#define XML_PARSER_RELAXED 1
+#define XML_PARSER_MULTI_TEXT 2
+
+/* node name for extra text chunks */
+#define CDATA_MARKER "[CDATA]"
/* xml property */
typedef struct xml_property_s {
@@ -46,6 +52,14 @@ typedef struct xml_property_s {
} xml_property_t;
/* xml node */
+/* .data contains any text which precedes any subtree elements;
+ * subtree elements may also contain only text; if so, name is "[CDATA]".
+ * e.g. <a>b<c />d</a>
+ * node1: .name="a" .data="b" .child=node2 .next=NULL
+ * node2: .name="c" .data=NULL .child=NULL .next=node3
+ * node3: .name="[CDATA]" .data="d" .child=NULL .next=NULL
+ * Adjacent text items are merged.
+ */
typedef struct xml_node_s {
char *name;
char *data;
@@ -58,6 +72,7 @@ void xml_parser_init(const char * buf, int size, int mode) XINE_PROTECTED;
int xml_parser_build_tree(xml_node_t **root_node) XINE_PROTECTED;
int xml_parser_build_tree_relaxed(xml_node_t **root_node, int relaxed) XINE_PROTECTED;
+int xml_parser_build_tree_with_options(xml_node_t **root_node, int flags) XINE_PROTECTED;
void xml_parser_free_tree(xml_node_t *root_node) XINE_PROTECTED;