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

SAXClient Class Reference

#include <SAXClient.hpp>

List of all members.

Static Public Methods

void HandleAttribName (char *str, int len, char iscont)
void HandleAttribValue (char *str, int len, char iscont)
void HandleAttribWhiteSpaces (char *str, int len, char iscont)
void HandleStartLabel (char *str, int len, char iscont)
void HandleEndLabel (char *str, int len, char iscont)
void HandleText (char *str, int len, char iscont, int leftwslen, int rightwslen)
void HandleComment (char *str, int len, char iscont)
void HandlePI (char *str, int len, char iscont)
void HandleDOCTYPE (char *str, int len, char iscont)
void HandleCDATA (char *str, int len, char iscont)


Member Function Documentation

void SAXClient::HandleAttribName char *    str,
int    len,
char    iscont
[static]
 

Definition at line 140 of file SAXClient.cpp.

00142 {
00143    // We simply create a new attribute, if it does not already exist
00144    TLabelID labelid=globallabeldict.FindLabelOrAttrib(str,len,1);
00145 
00146    if(labelid==LABEL_UNDEFINED)
00147       labelid=globallabeldict.CreateLabelOrAttrib(str,len,1);
00148 
00149    // We add it to the current path
00150    curpath.AddLabel(labelid);
00151 
00152    // We store the label ID
00153    StoreStartLabel(labelid);
00154 }

void SAXClient::HandleAttribValue char *    str,
int    len,
char    iscont
[static]
 

Definition at line 156 of file SAXClient.cpp.

00158 {
00159    // We simply compress and store the text
00160    CompressTextItem(str,len,0,0);
00161 
00162    // We remove the attribute label from the path stack
00163    curpath.RemoveLabel();
00164 
00165    // We store the end label token
00166    StoreEndLabel();
00167 }

void SAXClient::HandleAttribWhiteSpaces char *    str,
int    len,
char    iscont
[static]
 

Definition at line 169 of file SAXClient.cpp.

00170 {
00171    if(globalattribwhitespacescompress!=WHITESPACE_IGNORE)
00172    {
00173       if(len>0)
00174       {
00175          globalwhitespacecont->StoreUInt32(len);
00176          globalwhitespacecont->StoreData(str,len);
00177          globaltreecont->StoreCompressedSInt(0,TREETOKEN_ATTRIBWHITESPACE);
00178       }
00179    }
00180 }

void SAXClient::HandleCDATA char *    str,
int    len,
char    iscont
[static]
 

Definition at line 336 of file SAXClient.cpp.

00338 {
00339    if(!ignore_cdata)
00340    {
00341       globaltreecont->StoreCompressedSInt(0,TREETOKEN_SPECIAL);
00342       globalspecialcont->StoreUInt32(len);
00343       globalspecialcont->StoreData(str,len);
00344    }
00345 }

void SAXClient::HandleComment char *    str,
int    len,
char    iscont
[static]
 

Definition at line 303 of file SAXClient.cpp.

00305 {
00306    if(!ignore_comment)
00307    {
00308       globaltreecont->StoreCompressedSInt(0,TREETOKEN_SPECIAL);
00309       globalspecialcont->StoreUInt32(len);
00310       globalspecialcont->StoreData(str,len);
00311    }
00312 }

void SAXClient::HandleDOCTYPE char *    str,
int    len,
char    iscont
[static]
 

Definition at line 325 of file SAXClient.cpp.

00327 {
00328    if(!ignore_doctype)
00329    {
00330       globaltreecont->StoreCompressedSInt(0,TREETOKEN_SPECIAL);
00331       globalspecialcont->StoreUInt32(len);
00332       globalspecialcont->StoreData(str,len);
00333    }
00334 }

void SAXClient::HandleEndLabel char *    str,
int    len,
char    iscont
[static]
 

Definition at line 205 of file SAXClient.cpp.

00207 {
00208    TLabelID labelid=curpath.RemoveLabel();
00209    TLabelID endlabelid;
00210 
00211    // Let's check that the end label doesn't have any trailing white spaces
00212    while((len>0)&&
00213          ((str[len-1]=='\n')||(str[len-1]=='\r')||(str[len-1]=='\t')||(str[len-1]==' ')))
00214    {
00215       Error("End label has trailing white spaces!");
00216       PrintErrorMsg();
00217       len--;
00218    }
00219 
00220    // Was the current path empty? I.e. we didn't have any corresponding starting label?
00221    // ==> Exit
00222    if(labelid==LABEL_UNDEFINED)
00223    {
00224       Error("Unexpected end label '");
00225       ErrorCont(str,len);
00226       ErrorCont("' !");
00227       xmlparser->XMLParseError("");
00228    }
00229 
00230    if(str==NULL)  // Did we have an empty element of the form <label/> ?
00231       StoreEmptyEndLabel();
00232    else
00233    {
00234       // Otherwise, let's check whether the end label is the same as the start label
00235       endlabelid=globallabeldict.FindLabelOrAttrib(str,len,0);
00236 
00237       if(endlabelid!=labelid) // Not the same?
00238                               // We look at the previous label in the path
00239                               // If this is not equal either, then we exit
00240       {
00241          char *ptr;
00242          unsigned long startlen=globallabeldict.LookupCompressLabel(labelid,&ptr);
00243 
00244          TLabelID prevlabelid=curpath.RemoveLabel();
00245          if(prevlabelid!=endlabelid)
00246          {
00247             Error("End label '");
00248             ErrorCont(str,len);
00249             ErrorCont("' does not match start label '");
00250             ErrorCont(ptr,startlen);
00251             ErrorCont("' !");
00252             xmlparser->XMLParseError("");
00253          }
00254 
00255          // The previous label was equal,
00256          char tmpstr[100];
00257 
00258          Error("Warning: End label '");
00259          ErrorCont(str,len);
00260          sprintf(tmpstr,"' in line %lu does not match start label '",xmlparser->GetCurLineNo());
00261          ErrorCont(tmpstr);
00262          ErrorCont(ptr,startlen);
00263          ErrorCont("'!\n => Additional end label inserted!");
00264          PrintErrorMsg();
00265 
00266          // We store one additional end tag token
00267          StoreEndLabel();
00268       }
00269       StoreEndLabel();
00270    }
00271 }

void SAXClient::HandlePI char *    str,
int    len,
char    iscont
[static]
 

Definition at line 314 of file SAXClient.cpp.

00316 {
00317    if(!ignore_pi)
00318    {
00319       globaltreecont->StoreCompressedSInt(0,TREETOKEN_SPECIAL);
00320       globalspecialcont->StoreUInt32(len);
00321       globalspecialcont->StoreData(str,len);
00322    }
00323 }

void SAXClient::HandleStartLabel char *    str,
int    len,
char    iscont
[static]
 

Definition at line 182 of file SAXClient.cpp.

00184 {
00185    // Find or create the attribute
00186    TLabelID labelid=globallabeldict.FindLabelOrAttrib(str,len,0);
00187 
00188    if((len==9)&&(memcmp(str,"CARBOHYD ",9)==0))
00189       labelid=labelid;
00190 
00191    if(labelid==LABEL_UNDEFINED)
00192    {
00193       labelid=globallabeldict.CreateLabelOrAttrib(str,len,0);
00194       if(labelid==LABEL_UNDEFINED)
00195          labelid=LABEL_UNDEFINED;
00196    }
00197 
00198    // Add the label to the path
00199    curpath.AddLabel(labelid);
00200 
00201    // Store the start label in the schema container
00202    StoreStartLabel(labelid);
00203 }

void SAXClient::HandleText char *    str,
int    len,
char    iscont,
int    leftwslen,
int    rightwslen
[static]
 

Definition at line 273 of file SAXClient.cpp.

00275 {
00276    if((leftwslen==len)&&(rightwslen==len))
00277       // Is the entire text block only containing white spaces ?
00278    {
00279       // Depending on the flag for full white space text, we either
00280       // ignore, store them in a global container or treat them as text.
00281       switch(globalfullwhitespacescompress)
00282       {
00283       case WHITESPACE_IGNORE:
00284          return;
00285 
00286       case WHITESPACE_STOREGLOBAL:
00287          globaltreecont->StoreCompressedSInt(0,TREETOKEN_WHITESPACE);
00288          globalwhitespacecont->StoreUInt32(len);
00289          globalwhitespacecont->StoreData(str,len);
00290          return;
00291 
00292       case WHITESPACE_STORETEXT:
00293          CompressTextItem(str,len,0,0);
00294          return;
00295       }
00296    }
00297    // If there is some real text in the text block, then we use
00298    // the following function, which distributes the text to the
00299    // appropriate user compressor
00300    CompressTextItem(str,len,leftwslen,rightwslen);
00301 }


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