docgenerators/main.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <unistd.h>
00013
00014 #include <libxml/xmlmemory.h>
00015 #include <libxml/debugXML.h>
00016 #include <libxml/HTMLtree.h>
00017 #include <libxml/xmlIO.h>
00018 #include <libxml/DOCBparser.h>
00019 #include <libxml/xinclude.h>
00020 #include <libxml/catalog.h>
00021 #include <libxslt/xslt.h>
00022 #include <libxslt/xsltInternals.h>
00023 #include <libxslt/transform.h>
00024 #include <libxslt/xsltutils.h>
00025
00026
00027 #include <kaboutdata.h>
00028 #include <kapplication.h>
00029 #include <kcmdlineargs.h>
00030 #include <kconfig.h>
00031 #include <klocale.h>
00032 #include <ktip.h>
00033 #include <kdebug.h>
00034 #include <kwin.h>
00035
00036 #include "version.h"
00037
00038 extern int xmlLoadExtDtdDefaultValue;
00039
00040 static const char description[] =
00041 I18N_NOOP("Umbrello UML Modeller autonomous code generator");
00042
00043
00044
00045 static KCmdLineOptions options[] =
00046 {
00047 { "+[File]", I18N_NOOP("File to transform"), 0 },
00048 { "xslt <url>", I18N_NOOP("The XSLT file to use"), 0},
00049
00050 KCmdLineLastOption
00051 };
00052
00053 int main(int argc, char *argv[])
00054 {
00055 xsltStylesheetPtr cur = NULL;
00056 xmlDocPtr doc, res;
00057
00058 const char *params[16 + 1];
00059 int nbparams = 0;
00060 params[nbparams] = NULL;
00061
00062 KAboutData aboutData( "umbodoc", I18N_NOOP("Umbrello UML Modeller autonomous code generator"),
00063 UMBRELLO_VERSION, description, KAboutData::License_GPL,
00064 I18N_NOOP("(c) 2006 Gael de Chalendar (aka Kleag), (c) 2002-2006 Umbrello UML Modeller Authors"), 0,
00065 "http://uml.sf.net/");
00066 aboutData.addAuthor("Gael de Chalendar (aka Kleag)",0, "kleag@free.fr");
00067 aboutData.addAuthor(I18N_NOOP("Umbrello UML Modeller Authors"), 0, "uml-devel@lists.sourceforge.net");
00068 KCmdLineArgs::init( argc, argv, &aboutData );
00069 KCmdLineArgs::addCmdLineOptions( options );
00070
00071 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
00072
00073 QCStringList xsltOpt = args->getOptionList("xslt");
00074 if (xsltOpt.size() > 0)
00075 {
00076 QString xsltFile(xsltOpt.last());
00077
00078 xmlSubstituteEntitiesDefault(1);
00079 xmlLoadExtDtdDefaultValue = 1;
00080 cur = xsltParseStylesheetFile((const xmlChar *)xsltFile.latin1());
00081 doc = xmlParseFile(args->url( 0 ).url().latin1());
00082 res = xsltApplyStylesheet(cur, doc, params);
00083 xsltSaveResultToFile(stdout, res, cur);
00084
00085 xsltFreeStylesheet(cur);
00086 xmlFreeDoc(res);
00087 xmlFreeDoc(doc);
00088
00089 xsltCleanupGlobals();
00090 xmlCleanupParser();
00091 }
00092 return(0);
00093 }
00094
This file is part of the documentation for umbrello Version 3.1.0.