Main Page   Modules   Namespace List   Data Structures   File List   Data Fields   Examples  

testxml.c

Example code for using the XML extension.

/*
 * libsgml -- SGML state machine parsing library.
 *                                                                  
 * Copyright (c) 2002 Uninformed Research (http://www.uninformed.org)
 * All rights reserved.
 *
 * skape
 * [email protected]
 */
#include <stdlib.h>
#include <stdio.h>

#include "libsgml.h"

int main(int argc, char **argv)
{
        SGML_PARSER  sgml;
        char         *string;
        unsigned long stringLength = 0;

        sgmlParserInitialize(&sgml, SGML_EXTENSION_TYPE_XML, NULL, NULL);

        sgmlParserParseFile(&sgml, (argc > 1)?argv[1]:"test.sgml");
        
        stringLength = domNodeSerializeToString(sgmlExtensionXmlGetDocument(&sgml), &string);

        fprintf(stdout, "XML document (length=%lu):\n\n", stringLength);

        fprintf(stdout, "%s\n\n", string);

        free(string);

        sgmlParserDestroy(&sgml, 0);

        return 1;
}

Generated on Tue Mar 25 19:49:04 2003 for libsgml by doxygen1.3-rc3