-
Notifications
You must be signed in to change notification settings - Fork 80
API_xar_subdoc_new
Rob Braun edited this page Jan 28, 2007
·
2 revisions
Allocate and initialize a new subdocument
XAR has the ability to store other XML document within its XML header, along side the archive's Table of Contents. This function allocates and initializes a structure for storing the subdocument in the archive. x is an archive to associate the subdocument with. It must have been allocated and initialized by xar_open(). name is an identifier for the subdocument within the archive. This doesn't have to be unique, but it will make your life much easier if it is unique within the archive. On return, xar_subdoc_new returns a newly allocated and initialized subdocument structure, or NULL if it failed.
#include <xar/xar.h> int main(int argc, char *argv[]) { xar_t x; xar_subdoc_t s; x = xar_open(argv[1], WRITE); if( x == NULL ) { fprintf(stderr, "Error opening xarchive: %s\n", argv[1]); exit(1); } s = xar_subdoc_new(x, "foo"); if( s == NULL ) { fprintf(stderr, "Error creating new subdocument foo\n"); } ... xar_close(x); ... }