Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

int Impala::Application::SDash::Sax2Reader::Read (  )  [inline]

Definition at line 233 of file Sax2Reader.h.

References Impala::Application::SDash::Sax2Handler::getSawErrors(), mDoList, mFileToRead, mHandler, and mParser.

00234     {
00235         if (mFileToRead.empty())
00236             return 1;
00237 
00238         const char* fileToParse = 0;
00239         unsigned long duration;
00240         bool errorOccurred = false;
00241 
00242         bool more = true;
00243         XERCES_STD_QUALIFIER ifstream fin;
00244 
00245         // the input is a list file
00246         if (mDoList)
00247             fin.open(mFileToRead.c_str());
00248 
00249         if (fin.fail()) {
00250             XERCES_STD_QUALIFIER cerr <<"Cannot open the list file: " << mFileToRead << XERCES_STD_QUALIFIER endl;
00251             return 2;
00252         }
00253 
00254         while (more)
00255         {
00256             char fURI[1000];
00257             //initialize the array to zeros
00258             memset(fURI,0,sizeof(fURI));
00259 
00260             if (mDoList) {
00261                 if (! fin.eof() ) {
00262                     fin.getline (fURI, sizeof(fURI));
00263                     if (!*fURI)
00264                         continue;
00265                     else {
00266                         fileToParse = fURI;
00267                         XERCES_STD_QUALIFIER cerr << "==Parsing== " << fileToParse << XERCES_STD_QUALIFIER endl;
00268                     }
00269                 }
00270                 else
00271                     break;
00272             }
00273             else {
00274                 fileToParse = mFileToRead.c_str();
00275                 more = false; // not a list, parse just one file
00276             }
00277 
00278             mHandler->resetErrors();
00279 
00280             try
00281             {
00282                 const unsigned long startMillis = XMLPlatformUtils::getCurrentMillis();
00283                 mParser->parse(fileToParse);
00284                 const unsigned long endMillis = XMLPlatformUtils::getCurrentMillis();
00285                 duration = endMillis - startMillis;
00286             }
00287             catch (const OutOfMemoryException&)
00288             {
00289                 XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl;
00290                 errorOccurred = true;
00291                 continue;
00292             }
00293             catch (const XMLException& e)
00294             {
00295                 XERCES_STD_QUALIFIER cerr << "\nError during parsing: '" << fileToParse << "'\n"
00296                     << "Exception message is:  \n"
00297                     << StrX(e.getMessage()) << "\n" << XERCES_STD_QUALIFIER endl;
00298                 errorOccurred = true;
00299                 continue;
00300             }
00301 
00302             catch (...)
00303             {
00304                 XERCES_STD_QUALIFIER cerr << "\nUnexpected exception during parsing: '" << fileToParse << "'\n";
00305                 errorOccurred = true;
00306                 continue;
00307             }
00308 
00309             if (!mHandler->getSawErrors())
00310             {
00311                 //XERCES_STD_QUALIFIER cout << fileToParse << ": " << duration << " ms" << XERCES_STD_QUALIFIER endl;
00312             }
00313             else
00314                 errorOccurred = true;
00315 
00316         } // while (more)
00317 
00318         if (mDoList)
00319             fin.close();
00320 
00321         if (errorOccurred)
00322             return 3; // if failed on at least one xml file to be parsed 
00323         else
00324             return 0;
00325 
00326     } // Read()

Here is the call graph for this function:


Generated on Fri Mar 19 10:49:39 2010 for ImpalaSrc by  doxygen 1.5.1