45 #ifndef INCL_UTIL_NAD_H
46 #define INCL_UTIL_NAD_H 1
52 #ifdef HAVE_SYS_TYPES_H
53 # include <sys/types.h>
59 # ifdef JABBERD2_EXPORTS
60 # define JABBERD2_API __declspec(dllexport)
62 # define JABBERD2_API __declspec(dllimport)
65 # define JABBERD2_API extern
183 #define NAD_ENAME(N,E) (N->cdata + N->elems[E].iname)
184 #define NAD_ENAME_L(N,E) (N->elems[E].lname)
185 #define NAD_CDATA(N,E) (N->cdata + N->elems[E].icdata)
186 #define NAD_CDATA_L(N,E) (N->elems[E].lcdata)
187 #define NAD_ANAME(N,A) (N->cdata + N->attrs[A].iname)
188 #define NAD_ANAME_L(N,A) (N->attrs[A].lname)
189 #define NAD_AVAL(N,A) (N->cdata + N->attrs[A].ival)
190 #define NAD_AVAL_L(N,A) (N->attrs[A].lval)
191 #define NAD_NURI(N,NS) (N->cdata + N->nss[NS].iuri)
192 #define NAD_NURI_L(N,NS) (N->nss[NS].luri)
193 #define NAD_NPREFIX(N,NS) (N->cdata + N->nss[NS].iprefix)
194 #define NAD_NPREFIX_L(N,NS) (N->nss[NS].lprefix)
196 #define NAD_ENS(N,E) (N->elems[E].my_ns)
197 #define NAD_ANS(N,A) (N->attrs[A].my_ns)
struct nad_elem_st * elems
JABBERD2_API void nad_append_cdata(nad_t nad, const char *cdata, int len, int depth)
append more cdata to the last element
JABBERD2_API int nad_append_attr(nad_t nad, int ns, const char *name, const char *val)
append attribs to the last element
struct nad_attr_st * attrs
JABBERD2_API void nad_print(nad_t nad, int elem, const char **xml, int *len)
create a string representation of the given element (and children), point references to it ...
JABBERD2_API nad_t nad_new(void)
create a new nad
JABBERD2_API void nad_serialize(nad_t nad, char **buf, int *len)
serialize and deserialize a nad
JABBERD2_API int nad_insert_elem(nad_t nad, int elem, int ns, const char *name, const char *cdata)
insert and return a new element as a child of this one
JABBERD2_API int nad_insert_nad(nad_t dest, int delem, nad_t src, int selem)
insert part of a nad into another nad
JABBERD2_API int nad_find_elem_path(nad_t nad, int elem, int ns, const char *name)
find elem using XPath like query name – "name" for the child tag of that name "name/name" for a sub c...
JABBERD2_API int nad_find_scoped_namespace(nad_t nad, const char *uri, const char *prefix)
find a namespace in scope (and optionally prefix)
JABBERD2_API void nad_free(nad_t nad)
free that nad
JABBERD2_API int nad_append_elem(nad_t nad, int ns, const char *name, int depth)
append and return a new element
JABBERD2_API int nad_append_namespace(nad_t nad, int elem, const char *uri, const char *prefix)
declare a namespace on an already existing element
JABBERD2_API nad_t nad_deserialize(const char *buf)
JABBERD2_API int nad_find_elem(nad_t nad, int elem, int ns, const char *name, int depth)
find the next element with this name/depth
JABBERD2_API void nad_wrap_elem(nad_t nad, int elem, int ns, const char *name)
wrap an element with another element
JABBERD2_API int nad_add_namespace(nad_t nad, const char *uri, const char *prefix)
add a namespace to the next element (ie, called when the namespace comes into scope) ...
JABBERD2_API int nad_find_namespace(nad_t nad, int elem, const char *uri, const char *prefix)
find the first matching namespace (and optionally prefix)
JABBERD2_API void nad_set_attr(nad_t nad, int elem, int ns, const char *name, const char *val, int vallen)
reset or store the given attribute
JABBERD2_API int nad_find_attr(nad_t nad, int elem, int ns, const char *name, const char *val)
find the first matching attribute (and optionally value)
JABBERD2_API void nad_drop_elem(nad_t nad, int elem)
remove an element (and its subelements)
JABBERD2_API nad_t nad_parse(const char *buf, int len)
create a nad from raw xml
JABBERD2_API nad_t nad_copy(nad_t nad)
copy a nad