xmltree.cpp

Go to the documentation of this file.
00001 #include <QObject>
00002 #include <QMessageBox>
00003 #include <QTextCodec>
00004 
00005 #include "xmltree.h"
00006 #include "main.h"
00007 #include "recordtabledata.h"
00008 
00009 xmltree::xmltree(void)
00010 {
00011     
00012 }
00013 
00014 xmltree::~xmltree(void)
00015 {
00016     
00017 }
00018 
00019 bool xmltree::load(QString file)
00020 {
00021  // Загрузка файла дерева разделов
00022  QFile xmlfile(file); 
00023  
00024  // Если файл не может быть загружен
00025  if(!xmlfile.open(QIODevice::ReadOnly | QIODevice::Text))
00026  {
00027   QMessageBox::information(0, tr("Error"),
00028                               tr("Cannot read file %1:\n%2.")
00029                               .arg(file)
00030                               .arg(xmlfile.errorString()));
00031   return false;
00032  }
00033 
00034  // Преобразование xml-документа в Dom представление
00035  QString errorStr;
00036  int errorLine;
00037  int errorColumn;
00038  if (!dommodel.setContent(&xmlfile, true, &errorStr, &errorLine,&errorColumn)) 
00039   {
00040    QMessageBox::information(0, tr("Error convert to DOM dataform"),
00041                                       tr("Parse error at line %1, column %2:\n%3")
00042                                       .arg(errorLine)
00043                                       .arg(errorColumn)
00044                                       .arg(errorStr));
00045    return false;
00046   }
00047 
00048  return true;
00049 }
00050 

Generated on Mon Feb 2 00:25:34 2009 for mytetra by  doxygen 1.5.1