rem: if ( !dtdFile.open( IO_ReadOnly ) ) {
add: if ( !dtdFile.open( QIODevice::ReadOnly ) ) {
context: int main( int argc, char **argv ){  KAboutData aboutData( "kxml_compiler", I18N_NOOP("KDE xml compiler"), "0.1",  	I18N_NOOP("KDE XML Compiler") , KAboutData::License_LGPL );  aboutData.addAuthor( "Cornelius Schumacher", 0, "schumacher@kde.org" );  KCmdLineArgs::init( argc, argv, &aboutData );  KCmdLineArgs::addCmdLineOptions( options );  KInstance app( &aboutData );  KCmdLineArgs *args = KCmdLineArgs::parsedArgs();  if ( args->count() < 1 ) {    kdError() << "Too few arguments." << endl;    return 1;  }  if ( args->count() > 1 ) {    kdError() << "Too many arguments." << endl;    return 1;  }  QString baseDir = QFile::decodeName( args->getOption( "directory" ) );  if ( !baseDir.endsWith( "/" ) ) baseDir.append( "/" );  QString dtdFilename = args->url( 0 ).path();  QString baseName = args->url( 0 ).fileName();  int pos = baseName.findRev( '.' );  if ( pos > 0 ) baseName = baseName.left( pos );  QFile dtdFile( dtdFilename );  if ( !dtdFile.open( IO_ReadOnly ) ) {    kdError() << "Unable to open '" << dtdFilename << "'" << endl;    return 1;  }  QString errorMsg;  int errorLine, errorCol;  QDomDocument doc;  if ( !doc.setContent( &dtdFile, false, &errorMsg, &errorLine, &errorCol ) ) {    kdError() << errorMsg << " at " << errorLine << "," << errorCol << endl;    return 1;  }  kdDebug() << "Begin parsing" << endl;  Parser p;  Element *start = p.parse( doc.documentElement() );  if ( !start ) {    kdError() << "Could not find start element" << endl;    return 1;  }  p.dumpDefinitionMap();  //  return 0;  p.substituteReferences( start );#if 0    std::cout << "--- TREE:" << std::endl;  p.dumpTree( start );#endif  kdDebug() << "Begin creating code" << endl;  Creator::XmlParserType pt;  if ( args->isSet( "custom-parser" ) ) {    pt = Creator::XmlParserCustomExternal;  } else if ( args->isSet( "external-parser" ) ) {    pt = Creator::XmlParserDomExternal;  } else {    pt = Creator::XmlParserDom;  }  Creator c( pt );  kdDebug() << "Create classes" << endl;  QValueList<Element *>::ConstIterator it;  for( it = start->elements.begin(); it != start->elements.end(); ++it ) {    c.createClass( *it );  }  kdDebug() << "Create parser" << endl;  for( it = start->elements.begin(); it != start->elements.end(); ++it ) {    c.setExternalClassPrefix( c.upperFirst( (*it)->name ) );    c.createFileParser( *it );    c.createFileWriter( *it, dtdFilename.replace( "rng", "dtd" ) );  }  c.createListTypedefs();#if 0  QValueList<Reference *>::ConstIterator it2;  for( it2 = start->references.begin(); it2 != start->references.end();       ++it2 ) {    Element e;    e.name = (*it2)->name;    e.pattern = (*it2)->pattern;    c.createClass( &e );  }#endif  kdDebug() << "Begin printing code" << endl;  KODE::File &f = c.file();    f.setFilename( baseName );  KODE::Printer printer;  printer.setCreationWarning( true );  printer.setGenerator( KCmdLineArgs::cwd() + KCmdLineArgs::appName() );  printer.setOutputDirectory( baseDir );  printer.setSourceFile( args->url( 0 ).fileName() );  c.printFiles( printer );  kdDebug() << "Finished." << endl;}