Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

XMLParse Class Reference

#include <XMLParse.hpp>

Inheritance diagram for XMLParse::

FileParser Input CFile List of all members.

Public Methods

void XMLParseError (char *errmsg)
void XMLParseError (char *errmsg, int savelineno)
char DoParsing (SAXClient *myclient)

Member Function Documentation

char XMLParse::DoParsing SAXClient   myclient [inline]
 

Definition at line 445 of file XMLParse.hpp.

00447    {
00448       saxclient=myclient;
00449 
00450       xmlparser=this;
00451 
00452       char c[9];
00453 
00454       do
00455       {
00456          // Let's start parsing text
00457          ParseText();
00458 
00459          // If have reached the end of the file, we exit
00460          if(IsEndOfFile())
00461             return 1;
00462 
00463          // The next character must be an '<' character
00464          PeekChar(c);
00465          if(*c!='<') // This should actually be never true
00466          {
00467             Error("Character '<' expected !");
00468             XMLParseError("");
00469          }
00470 
00471          // let's look at the next three characters
00472          PeekData(c,3);
00473 
00474          switch(c[1])
00475          {
00476             case '?': // Processing Instruction ?
00477                if(c[2]=='>')
00478                {
00479                   SkipChar();
00480                   ParseLabel();
00481                }
00482                else
00483                   ParsePI();
00484                break;
00485 
00486             case '!':
00487                switch(c[2])
00488                {
00489                case '[': // We have <![CDATA[... ]]>
00490                   PeekData(c,9);
00491                   if(memcmp(c,"<![CDATA[",9)!=0)
00492                   {
00493                      Error("Invalid tag '");
00494                      ErrorCont(c,9);
00495                      ErrorCont("...' should probably be '<![CDATA ...' !");
00496                      XMLParseError("");
00497                   }
00498                   ParseCDATA();
00499                   break;
00500       
00501                case 'D': // We must have <!DOCTYPE ... [ ... ] >
00502                {
00503                   PeekData(c,9);
00504                   if(memcmp(c,"<!DOCTYPE",9)!=0)
00505                   {
00506                      Error("Invalid tag '");
00507                      ErrorCont(c,9);
00508                      ErrorCont("...' should probably be '<!DOCTYPE ...' !");
00509                      XMLParseError("");
00510                   }
00511                   ParseDOCTYPE();
00512                }
00513                break;
00514 
00515                case '-': // We (probably) have a comment <!-- ... -->
00516                   PeekData(c,4);
00517 
00518                   if(c[3]!='-')
00519                   {
00520                      Error("Invalid tag '");
00521                      ErrorCont(c,4);
00522                      ErrorCont("...' should probably be '<!-- ...' !");
00523                      XMLParseError("");
00524                   }
00525                   ParseComment();
00526                   break;
00527 
00528                default:
00529                   Error("Invalid tag '");
00530                   ErrorCont(c,3);
00531                   ErrorCont("...' !");
00532                   XMLParseError("");
00533                }
00534                break;
00535 
00536          case '=':
00537             Error("Invalid label '<=...'!");
00538             PrintErrorMsg();
00539             SkipChar();
00540             saxclient->HandleText("<",1,0,0,0);
00541             break;
00542 
00543          default: // If we only have a simple '<', we skip the character and
00544                   // parse the following label
00545             SkipChar();
00546             ParseLabel();
00547          }
00548       }
00549       while(allocatedmemory<memory_cutoff);
00550          // We perform the parsing as long as the allocated memory is smaller than the
00551          // memory cut off
00552 
00553       return 0;
00554    }

void XMLParse::XMLParseError char *    errmsg,
int    savelineno
[inline]
 

Definition at line 68 of file XMLParse.hpp.

00070    {
00071       char tmpstr[50];
00072       sprintf(tmpstr,errmsg,savelineno);
00073       Error(tmpstr);
00074       Exit();
00075    }

void XMLParse::XMLParseError char *    errmsg [inline]
 

Definition at line 58 of file XMLParse.hpp.

00060    {
00061       char tmpstr[50];
00062       sprintf(tmpstr,"Parse error in line %lu:\n",GetCurLineNo());
00063       Error(tmpstr);
00064       ErrorCont(errmsg);
00065       Exit();
00066    }


The documentation for this class was generated from the following file:
Generated on Sat Oct 13 16:08:57 2001 for XMILL by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001