DragonFly On-Line Manual Pages

Search: Section:  


KCGIXML(3)            DragonFly Library Functions Manual            KCGIXML(3)

NAME

kcgixml, kxml_close, kxml_open, kxml_push, kxml_pushattrs, kxml_pushnull, kxml_pushnullattrs, kxml_pop, kxml_popall, kxml_putc, kxml_puts, kxml_write - XML handling functions for kcgi

LIBRARY

library "libkcgixml"

SYNOPSIS

#include <stdint.h> #include <kcgi.h> #include <kcgixml.h> int kxml_close(struct kxmlreq *xml); void kxml_open(struct kxmlreq *xml, struct kreq *req, const char *const *elems, size_t elemsz); int kxml_push(struct kxmlreq *xml, size_t elem); int kxml_pushattrs(struct kxmlreq *xml, size_t elem, ...); void kxml_pushnull(struct kxmlreq *xml, size_t elem); void kxml_pushnullattrs(struct kxmlreq *xml, size_t elem, ...); int kxml_pop(struct kxmlreq *xml); void kxml_popall(struct kxmlreq *xml); void kxml_putc(struct kxmlreq *xml, char c); void kxml_puts(struct kxmlreq *xml, const char *cp); int kxml_write(const char *cp, size_t sz, void *arg);

DESCRIPTION

The kcgixml functions extend kcgi(3) output with very simple XML-specific output. None of these functions may be called before khttp_body(3). All kcgixml sequences begin and end with kxml_open and kxml_close, respectively. An array of possible elements is passed as elems to kxml_open(). This is later indexed into with kxml_push(), kxml_pushnull(), kxml_pushattrs(), and kxml_pushnullattrs() to open elements. The kxml_pop() family closes out opened elements. To use these functions, you must include the <kcgixml.h> header and compile with library "kcgixml", for example, % cc -I/usr/local/include -c -o sample.o sample.c % cc -L/usr/local/lib -o sample -lkcgixml -lkcgi -lz kxml_close() Close an XML context as opened with kxml_open(). This will also close any open elements. You should not use the object after invoking this function. kxml_open() Open an XML context, binding it to elems, a set of elements (e.g., "DAV:set" or "html"), the number of elements elemsz, the kcgi(3) request object req, and an output object xml. kxml_push() Push the element-open tag indexed by elem() onto the output stream. kxml_pushattrs() Push the element-open tag indexed by elem() onto the output stream, as well as a sequence of nil-terminated pairs of attributes. The last attribute key must be a NULL to terminate the list. kxml_pushnull() Like kxml_push(), but producing an empty-element tag. kxml_pushnullattrs() Like kxml_pushattrs(), but producing an empty-element tag. kxml_pop() Pop the current open tag as opened by kxml_push() or kxml_pushattrs(). kxml_popall() Pop all open tags. kxml_putc() Write a single character within the currently-open tag, escaping it properly as opaque text. kxml_puts() Invokes kxml_putc() for all characters in the nil-terminated string. kxml_write() Invokes kxml_putc() for all elements in the bounded buffer.

RETURN VALUES

Functions returning an int indicating zero on failure and non-zero on success. This occurs if the requested element is over (for kxml_push()) or under (for kxml_pop()) the scope domain.

STANDARDS

The kcgixml functions conform to the XML 1.0 mark-up specification.

AUTHORS

The kcgixml library was written by Kristaps Dzonsons <kristaps@bsd.lv>. DragonFly 6.5-DEVELOPMENT January 4, 2016 DragonFly 6.5-DEVELOPMENT

Search: Section: