00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <KoXmlReader.h>
00020 #include <KoOasisStore.h>
00021 #include <KoDom.h>
00022 #include <kdebug.h>
00023 #include <assert.h>
00024
00025 #include <Q3CString>
00026
00027 void testMimeForPath( KoXmlDocument& doc )
00028 {
00029 QString mime = KoOasisStore::mimeForPath( doc, "Object 1" );
00030 kDebug() << k_funcinfo << mime << endl;
00031 assert( !mime.isNull() );
00032 assert( !mime.isEmpty() );
00033 assert( mime == "application/vnd.oasis.opendocument.text" );
00034 kDebug() << "testMimeForPath OK" << endl;
00035 }
00036
00037 int main( int, char** ) {
00038
00039 const Q3CString xml = "\
00040 <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
00041 <manifest:manifest xmlns:manifest=\"urn:oasis:names:tc:opendocument:xmlns:manifest:1.0\">\n\
00042 <manifest:file-entry manifest:media-type=\"application/vnd.oasis.opendocument.text\" manifest:full-path=\"/\"/>\n\
00043 <manifest:file-entry manifest:media-type=\"text/xml\" manifest:full-path=\"content.xml\"/>\n\
00044 <manifest:file-entry manifest:media-type=\"application/vnd.oasis.opendocument.text\" manifest:full-path=\"Object 1\"/>\n\
00045 </manifest:manifest> \
00046 ";
00047
00048 KoXmlDocument doc;
00049 QString errorMsg;
00050 int errorLine, errorColumn;
00051 bool ok = doc.setContent( xml, true , &errorMsg, &errorLine, &errorColumn );
00052 if ( !ok ) {
00053 kError() << "Parsing error! Aborting!" << endl
00054 << " In line: " << errorLine << ", column: " << errorColumn << endl
00055 << " Error message: " << errorMsg << endl;
00056 return 1;
00057 }
00058
00059 testMimeForPath( doc );
00060 return 0;
00061 }