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.16.1-x86-mingw32 vendor/local/share/doc/libxml2-2.9.8/html/io2.c
cairo-1.16.1-x64-mingw32 vendor/local/share/doc/libxml2-2.9.8/html/io2.c
cairo-1.16.0-x86-mingw32 vendor/local/share/doc/libxml2-2.9.8/html/io2.c
cairo-1.16.0-x64-mingw32 vendor/local/share/doc/libxml2-2.9.8/html/io2.c
cairo-1.15.14-x86-mingw32 vendor/local/share/doc/libxml2-2.9.7/html/io2.c
cairo-1.15.14-x64-mingw32 vendor/local/share/doc/libxml2-2.9.7/html/io2.c
cairo-1.15.13-x64-mingw32 vendor/local/share/doc/libxml2-2.9.7/html/io2.c
cairo-1.15.13-x86-mingw32 vendor/local/share/doc/libxml2-2.9.7/html/io2.c
cairo-1.15.12-x64-mingw32 vendor/local/share/doc/libxml2-2.9.7/html/io2.c
cairo-1.15.12-x86-mingw32 vendor/local/share/doc/libxml2-2.9.7/html/io2.c
cairo-1.15.11-x64-mingw32 vendor/local/share/doc/libxml2-2.9.7/html/io2.c
cairo-1.15.11-x86-mingw32 vendor/local/share/doc/libxml2-2.9.7/html/io2.c
cairo-1.15.10-x86-mingw32 vendor/local/share/doc/libxml2-2.9.6/html/io2.c
cairo-1.15.10-x64-mingw32 vendor/local/share/doc/libxml2-2.9.6/html/io2.c
cairo-1.15.9-x64-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/io2.c
cairo-1.15.9-x86-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/io2.c
cairo-1.15.8-x86-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/io2.c
cairo-1.15.8-x64-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/io2.c
cairo-1.15.7-x64-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/io2.c
cairo-1.15.7-x86-mingw32 vendor/local/share/doc/libxml2-2.9.4/html/io2.c