18 #include <sys/types.h>
94 #define LYXML_ELEM_MIXED 0x01
121 #define LYXML_PARSE_MULTIROOT 0x01
126 #define LYXML_PARSE_NOMIXEDCONTENT 0x02
145 struct lyxml_elem *lyxml_parse_mem(struct ly_ctx *ctx, const char *data, int options);
169 #define LYXML_PRINT_OPEN 0x01
173 #define LYXML_PRINT_FORMAT 0x02
177 #define LYXML_PRINT_CLOSE 0x04
181 #define LYXML_PRINT_ATTRS 0x08
184 #define LYXML_PRINT_SIBLINGS 0x10
189 #define LYXML_PRINT_NO_LAST_NEWLINE 0x20
207 int lyxml_print_file(FILE * stream, const struct lyxml_elem *elem, int options);
245 int lyxml_print_clb(ssize_t (*writeclb)(
void *arg,
const void *buf,
size_t count),
void *arg,
const struct lyxml_elem *elem,
int options);
int lyxml_print_mem(char **strp, const struct lyxml_elem *elem, int options)
Dump XML tree to a IO stream.
lyxml_attr_type
enumeration of attribute types
int lyxml_print_fd(int fd, const struct lyxml_elem *elem, int options)
Dump XML tree to a IO stream.
Element's attribute definition.
struct lyxml_elem * parent
void lyxml_free_withsiblings(struct ly_ctx *ctx, struct lyxml_elem *elem)
Free (and unlink from the XML tree) the specified (sub)tree with all its attributes and namespace def...
struct lyxml_elem * child
struct lyxml_ns * lyxml_get_ns(const struct lyxml_elem *elem, const char *prefix)
Get namespace definition of the given prefix in context of the specified element. ...
void lyxml_unlink(struct ly_ctx *ctx, struct lyxml_elem *elem)
Unlink the element from its parent. In contrast to lyxml_free(), after return the caller can still ma...
Structure describing an element in an XML tree.
int lyxml_print_clb(ssize_t(*writeclb)(void *arg, const void *buf, size_t count), void *arg, const struct lyxml_elem *elem, int options)
Dump XML tree to a IO stream.
struct lyxml_elem * lyxml_parse_path(struct ly_ctx *ctx, const char *filename, int options)
Parse XML from filesystem.
const char * lyxml_get_attr(const struct lyxml_elem *elem, const char *name, const char *ns)
Get value of the attribute in the specified element.
struct lyxml_elem * lyxml_dup(struct ly_ctx *ctx, struct lyxml_elem *root)
Duplicate the XML tree into the different content.
void lyxml_free(struct ly_ctx *ctx, struct lyxml_elem *elem)
Free (and unlink from the XML tree) the specified element with all its attributes and namespace defin...
enum lyxml_attr_type LYXML_ATTR_TYPE
enumeration of attribute types