1 /*
2  * xml.h
3  *
4  * Copyright (c) Chris Putnam 2004-2021
5  *
6  * Source code released under the GPL version 2
7  *
8  */
9 #ifndef XML_H
10 #define XML_H
11 
12 #include "slist.h"
13 #include "str.h"
14 
15 typedef struct xml {
16 	str tag;
17 	str value;
18 	slist attributes;
19 	slist attribute_values;
20 	struct xml *down;
21 	struct xml *next;
22 } xml;
23 
24 void   xml_init                 ( xml *node );
25 void   xml_free                 ( xml *node );
26 int    xml_has_value            ( xml *node );
27 str *  xml_value                ( xml *node );
28 char * xml_value_cstr           ( xml *node );
29 str *  xml_tag                  ( xml *node );
30 char * xml_tag_cstr             ( xml *node );
31 int    xml_tag_matches          ( xml *node, const char *tag );
32 int    xml_tag_matches_has_value( xml *node, const char *tag );
33 str *  xml_attribute            ( xml *node, const char *attribute );
34 char * xml_attribute_cstr       ( xml *node, const char *attribute );
35 char * xml_find_start           ( char *buffer, char *tag );
36 char * xml_find_end             ( char *buffer, char *tag );
37 int    xml_tag_has_attribute    ( xml *node, const char *tag, const char *attribute, const char *attribute_value );
38 int    xml_has_attribute        ( xml *node, const char *attribute, const char *attribute_value );
39 const char * xml_parse                ( const char *p, xml *onode );
40 
41 extern char * xml_pns; /* global Namespace */
42 
43 #endif
44 
45