Sha256: 07962de2e1c06578a48e396538c0997510103b594f962230fd85f26907997513

Contents?: true

Size: 1.15 KB

Versions: 103

Compression:

Stored size: 1.15 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 $(srcdir)/io2.res
 * 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

103 entries across 103 versions & 5 rubygems

Version Path
cairo-1.15.6-x86-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/io2.c
cairo-1.15.6-x64-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/io2.c
cairo-1.15.5-x64-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/io2.c
cairo-1.15.5-x86-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/io2.c
cairo-1.15.4-x86-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/io2.c
cairo-1.15.4-x64-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/io2.c
cairo-1.15.3-x86-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/io2.c
cairo-1.15.3-x64-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/io2.c
cairo-1.14.6-x86-mingw32 vendor/local/share/doc/libxml2-2.9.2/html/io2.c
cairo-1.14.6-x64-mingw32 vendor/local/share/doc/libxml2-2.9.2/html/io2.c
cairo-1.15.2-x64-mingw32 vendor/local/share/doc/libxml2-2.9.2/html/io2.c
cairo-1.15.2-x86-mingw32 vendor/local/share/doc/libxml2-2.9.2/html/io2.c
cairo-1.14.3-x86-mingw32 vendor/local/share/doc/libxml2-2.9.2/html/io2.c
cairo-1.14.3-x64-mingw32 vendor/local/share/doc/libxml2-2.9.2/html/io2.c
cairo-1.14.2-x64-mingw32 vendor/local/share/doc/libxml2-2.9.2/html/io2.c
cairo-1.14.2-x86-mingw32 vendor/local/share/doc/libxml2-2.9.2/html/io2.c
cairo-1.14.1-x86-mingw32 vendor/local/share/doc/libxml2-2.9.2/html/io2.c
cairo-1.14.1-x64-mingw32 vendor/local/share/doc/libxml2-2.9.2/html/io2.c
cairo-1.14.0-x64-mingw32 vendor/local/share/doc/libxml2-2.9.2/html/io2.c
cairo-1.14.0-x86-mingw32 vendor/local/share/doc/libxml2-2.9.2/html/io2.c