mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-25 01:55:39 +00:00
b203c33bb7
* 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
42 lines
692 B
C
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;
|
|
}
|
|
|