• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

KDocTools

meinproc_simple.cpp

Go to the documentation of this file.
00001 
00002 #include "meinproc_common.h"
00003 
00004 #include "xslt.h"
00005 
00006 #include <QCoreApplication>
00007 #include <QtCore/QString>
00008 #include <QtCore/QFile>
00009 #include <QtCore/QDir>
00010 #include <QtCore/QTextCodec>
00011 #include <QtCore/QFileInfo>
00012 #include <QtCore/QList>
00013 
00014 #include <libxml/xmlversion.h>
00015 #include <libxml/xmlmemory.h>
00016 #include <libxml/debugXML.h>
00017 #include <libxml/HTMLtree.h>
00018 #include <libxml/xmlIO.h>
00019 #include <libxml/catalog.h>
00020 #include <libxml/parserInternals.h>
00021 #include <libxslt/xsltconfig.h>
00022 #include <libxslt/xsltInternals.h>
00023 #include <libxslt/transform.h>
00024 #include <libxslt/xsltutils.h>
00025 #include <libexslt/exslt.h>
00026 
00027 #include <stdlib.h>
00028 #include <string.h>
00029 #include <sys/time.h>
00030 #include <unistd.h>
00031 
00032 #ifndef _WIN32
00033 extern "C" int xmlLoadExtDtdDefaultValue;
00034 #endif
00035 
00036 int main(int argc, char **argv) {
00037 
00038     // xsltSetGenericDebugFunc(stderr, NULL);
00039 
00040     QCoreApplication app( argc, argv );
00041 
00042     const QStringList arguments = app.arguments();
00043     if ( arguments.count() != 4 ) {
00044         qCritical() << "wrong argument count";
00045         return ( 1 );
00046     }
00047 
00048     const QString srcDir = arguments[1];
00049     const QString xmllintPath = arguments[2];
00050     const QString checkFilename = arguments[3];
00051     const QString customizationCatalog = srcDir + "/customization/catalog.xml";
00052     
00053     if ( checkFile( checkFilename ) != CheckFileSuccess )
00054     {
00055         qCritical() << "checkFile failed in " << checkFilename;
00056         return ( 2 );
00057     }
00058     if ( checkFile( customizationCatalog ) != CheckFileSuccess )
00059     {
00060         qCritical() << "checkFile failed in " << customizationCatalog;
00061         return ( 2 );
00062     }
00063 
00064     exsltRegisterAll();
00065 
00066     QByteArray catalogs;
00067     catalogs += customizationCatalog.toUtf8();
00068     
00069     setenv( "XML_CATALOG_FILES", catalogs.constData(), 1 );
00070     xmlInitializeCatalog();
00071 
00072     LIBXML_TEST_VERSION
00073 
00074     if ( check( checkFilename, xmllintPath, catalogs ) != CheckSuccess )
00075     {
00076         qWarning() << "Check failed";
00077         return 3;
00078     }
00079 
00080     xmlSubstituteEntitiesDefault(1);
00081     xmlLoadExtDtdDefaultValue = 1;
00082 
00083     QVector<const char *> params;
00084     params.append( NULL );
00085 
00086     const QString tss = srcDir + "/customization/kde-chunk.xsl";
00087     QString output = transform(checkFilename , tss, params);
00088     if (output.isEmpty()) {
00089         fprintf(stderr, "unable to parse %s\n", checkFilename.toLocal8Bit().data());
00090         return(4);
00091     }
00092 
00093     doOutput(output, true, false, QString(), false /* replaceCharset */);
00094 
00095     xmlCleanupParser();
00096     xmlMemoryDump();
00097     return(0);
00098 }
00099 

KDocTools

Skip menu "KDocTools"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal