Updated the copyright year.
[pwmd.git] / src / xml.h
blobaa3f0e4c420c0432875ba7d3ce43fd317cec5163
1 /* vim:tw=78:ts=8:sw=4:set ft=c: */
2 /*
3 Copyright (C) 2006-2011 Ben Kibbey <bjk@luxsci.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02110-1301 USA
19 #ifndef XML_H
20 #define XML_H
22 #include <libxml/tree.h>
23 #include <libxml/parser.h>
24 #include <libxml/xpath.h>
25 #include <glib.h>
27 #include "gettext.h"
28 #define N_(msgid) gettext(msgid)
30 struct element_list_s {
31 GSList *list;
32 gchar **elements;
33 gchar *prefix;
34 gint depth;
35 gboolean resolving;
36 gboolean recurse;
37 gboolean verbose;
38 gchar **req;
41 gint max_recursion_depth;
43 gpg_error_t new_root_element(xmlDocPtr doc, gchar *name);
44 xmlChar *new_document(void);
45 gpg_error_t list_root_elements(xmlDocPtr doc, GString **, gboolean);
46 gboolean valid_xml_element(xmlChar *element);
47 xmlNodePtr find_elements(xmlDocPtr doc, xmlNodePtr node,
48 gchar **req, gpg_error_t *error, gboolean *target,
49 xmlNodePtr (*found_fn)(xmlNodePtr, gchar **, gpg_error_t *, gchar **, void *),
50 xmlNodePtr (*not_found_fn)(xmlNodePtr, gchar **, gpg_error_t *, void *),
51 gboolean is_list_command, gint recursion_depth, void *data, gboolean stop);
52 xmlNodePtr find_root_element(xmlDocPtr doc, gchar ***req, gpg_error_t *error,
53 gboolean *target, gint recursion_depth, gboolean stop);
54 xmlNodePtr create_elements_cb(xmlNodePtr node, gchar **elements,
55 gpg_error_t *error, void *data);
56 xmlNodePtr create_target_elements_cb(xmlNodePtr node, gchar **elements,
57 gpg_error_t *error, void *data);
58 gboolean is_literal_element(gchar **element);
59 gboolean valid_element_path(gchar **path, gboolean has_value);
60 xmlNodePtr find_text_node(xmlNodePtr node);
61 gpg_error_t create_path_list(xmlDocPtr doc, struct element_list_s *elements,
62 gchar *path);
63 gpg_error_t recurse_xpath_nodeset(xmlDocPtr doc, xmlNodeSetPtr nodes,
64 xmlChar *value, xmlBufferPtr *result, gboolean, const xmlChar *);
65 gpg_error_t convert_xml(gchar **xml, goffset *len);
66 gpg_error_t add_attribute(xmlNodePtr node, const gchar *name,
67 const gchar *value);
68 xmlChar *node_has_attribute(xmlNodePtr n, xmlChar *attr);
69 gpg_error_t delete_attribute(xmlNodePtr n, const xmlChar *name);
70 gpg_error_t convert_elements(xmlDocPtr doc);
71 gpg_error_t validate_import(xmlNodePtr);
72 xmlNodePtr find_element(xmlNodePtr node, gchar *element, xmlNodePtr stop);
73 gpg_error_t update_element_mtime(xmlNodePtr n);
74 gpg_error_t unlink_node(xmlNodePtr n);
76 #endif