Sha256: 724a5f1ee07ce9d853875cb0b63ecc045a19af2d6badc8bd9ea7ebf2fcd05bc8

Contents?: true

Size: 1.16 KB

Versions: 50

Compression:

Stored size: 1.16 KB

Contents

/**
 * section: InputOutput
 * synopsis: Output to char buffer
 * purpose: Demonstrate the use of xmlDocDumpMemory
 *          to output document to a character buffer
 * usage: io2
 * test: io2 > io2.tmp ; diff io2.tmp io2.res ; rm -f io2.tmp
 * author: John Fleck
 * copy: see Copyright for the status of this software.
 */

#include <libxml/parser.h>

#if defined(LIBXML_TREE_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
int
main(void)
{

    xmlNodePtr n;
    xmlDocPtr doc;
    xmlChar *xmlbuff;
    int buffersize;

    /*
     * Create the document.
     */
    doc = xmlNewDoc(BAD_CAST "1.0");
    n = xmlNewNode(NULL, BAD_CAST "root");
    xmlNodeSetContent(n, BAD_CAST "content");
    xmlDocSetRootElement(doc, n);

    /*
     * Dump the document to a buffer and print it
     * for demonstration purposes.
     */
    xmlDocDumpFormatMemory(doc, &xmlbuff, &buffersize, 1);
    printf("%s", (char *) xmlbuff);

    /*
     * Free associated memory.
     */
    xmlFree(xmlbuff);
    xmlFreeDoc(doc);

    return (0);

}
#else
#include <stdio.h>

int
main(void)
{
    fprintf(stderr,
            "library not configured with tree and output support\n");
    return (1);
}
#endif

Version data entries

50 entries across 50 versions & 3 rubygems

Version Path
rsvg2-1.0.0-x86-mingw32 vendor/local/share/doc/libxml2-2.7.7/html/io2.c
gtksourceview2-1.0.0-x86-mingw32 vendor/local/share/doc/libxml2-2.7.7/html/io2.c
rsvg2-0.90.9-x86-mingw32 vendor/local/share/doc/libxml2-2.7.7/html/io2.c
gtksourceview2-0.90.9-x86-mingw32 vendor/local/share/doc/libxml2-2.7.7/html/io2.c
rsvg2-0.90.8-x86-mingw32 vendor/local/share/doc/libxml2-2.7.7/html/io2.c
gtksourceview2-0.90.8-x86-mingw32 vendor/local/share/doc/libxml2-2.7.7/html/io2.c
rsvg2-0.90.7-x86-mingw32 vendor/local/share/doc/libxml2-2.7.7/html/io2.c
gtksourceview2-0.90.7-x86-mingw32 vendor/local/share/doc/libxml2-2.7.7/html/io2.c
rsvg2-0.90.6-x86-mingw32 vendor/local/share/doc/libxml2-2.7.7/html/io2.c
gtksourceview2-0.90.6-x86-mingw32 vendor/local/share/doc/libxml2-2.7.7/html/io2.c