Ryujinx-GtkSharp/parser/formatXml.c
Rachel Hestilow b203c33bb7 2002-06-26 Rachel Hestilow <hestilow@ximian.com>
* generator/*.cs: Deal with whitespace XmlNodes.

	* parser/build.pl: Dump non-indented file to local directory.

	* parser/makefile, parser/formatXml.c: Added.

	* generator/gtkapi.xml: Nicely indented now. woo!

svn path=/trunk/gtk-sharp/; revision=5465
2002-06-26 13:10:48 +00:00

42 lines
692 B
C

#include <glib.h>
#include <stdlib.h>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
static int
formatFile (const gchar *input, const gchar *output)
{
xmlDocPtr doc;
/*
* build an XML tree from a the file;
*/
doc = xmlParseFile (input);
if (doc == NULL){
g_warning ("File %s empty or not well-formed.", input);
return -1;
}
if (xmlSaveFormatFile (output, doc, TRUE) == -1){
g_warning ("Error saving config data to %s", input);
}
xmlFreeDoc (doc);
return 0;
}
int main(int argc, char **argv)
{
if (argc != 3){
g_print ("Usage: formatXml inputfile outputfile\n\n");
return -1;
}
xmlKeepBlanksDefault(0);
formatFile (argv [1], argv [2]);
return 0;
}