1 #ifndef _WIMLIB_XMLPROC_H
2 #define _WIMLIB_XMLPROC_H
4 #include "wimlib/list.h"
5 #include "wimlib/types.h"
7 /*****************************************************************************/
16 enum xml_node_type type; /* type of node */
17 tchar *name; /* name of ELEMENT or ATTRIBUTE */
18 tchar *value; /* value of TEXT or ATTRIBUTE */
19 struct xml_node *parent; /* parent, or NULL if none */
20 struct list_head children; /* children; only used for ELEMENT */
21 struct list_head sibling_link;
24 /* Iterate through the children of an xml_node. Does nothing if passed NULL. */
25 #define xml_node_for_each_child(parent, child) \
26 if (parent) list_for_each_entry(child, &(parent)->children, sibling_link)
29 xml_node_is_element(const struct xml_node *node, const tchar *name)
31 return node->type == XML_ELEMENT_NODE && !tstrcmp(node->name, name);
35 xml_new_element(struct xml_node *parent, const tchar *name);
38 xml_new_element_with_text(struct xml_node *parent, const tchar *name,
42 xml_add_child(struct xml_node *parent, struct xml_node *child);
45 xml_unlink_node(struct xml_node *node);
48 xml_free_node(struct xml_node *node);
51 xml_element_get_text(const struct xml_node *element);
54 xml_element_set_text(struct xml_node *element, const tchar *text);
57 xml_get_attrib(const struct xml_node *element, const tchar *name);
60 xml_set_attrib(struct xml_node *element, const tchar *name, const tchar *value);
63 xml_replace_child(struct xml_node *parent, struct xml_node *replacement);
66 xml_clone_tree(struct xml_node *orig);
69 xml_legal_path(const tchar *name);
72 xml_legal_value(const tchar *value);
74 /*****************************************************************************/
77 xml_parse_document(const tchar *raw_doc, struct xml_node **doc_ret);
79 /*****************************************************************************/
89 xml_write_document(struct xml_node *doc, struct xml_out_buf *buf);
91 #endif /* _WIMLIB_XMLPROC_H */