SNAP Library 2.0, Developer Reference  2013-05-13 16:33:57
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TXmlLx Class Reference

#include <xml.h>

Collaboration diagram for TXmlLx:

List of all members.

Public Member Functions

void SkipWs ()
 TXmlLx (const PSIn &_SIn, const TXmlSpacing &_Spacing=xspIntact)
TXmlLxoperator= (const TXmlLx &)
TXmlLxSym GetSym ()
TStr GetSymStr () const
void EThrow (const TStr &MsgStr) const
TStr GetFPosStr () const
void ClrArgV ()
void AddArg (const TStr &ArgNm, const TStr &ArgVal)
bool IsArgNm (const TStr &ArgNm) const
int GetArgs () const
void GetArg (const int &ArgN, TStr &ArgNm, TStr &ArgVal) const
TStr GetArgVal (const TStr &ArgNm, const TStr &DfVal=TStr()) const
bool IsEntityNm (const TStr &EntityNm, TStr &EntityVal) const
void PutEntityVal (const TStr &Nm, const TStr &Val)
bool IsPEntityNm (const TStr &EntityNm, TStr &EntityVal) const
void PutPEntityVal (const TStr &Nm, const TStr &Val)

Static Public Member Functions

static char GetArgValQCh (const TStr &ArgVal)
static TStr GetXmlLxSymStr (const TXmlLxSym &XmlLxSym)
static bool IsTagNm (const TStr &Str)
static TStr GetXmlStrFromPlainMem (const TMem &PlainMem)
static TStr GetXmlStrFromPlainStr (const TChA &PlainChA)
static TStr GetPlainStrFromXmlStr (const TStr &XmlStr)
static TStr GetUsAsciiStrFromXmlStr (const TStr &EntRefStr)
static TStr GetChRefFromYuEntRef (const TStr &YuEntRefStr)

Public Attributes

TXmlLxSym Sym
TChA TxtChA
TStr TagNm
TStrKdV ArgNmValKdV

Private Member Functions

uchar GetCh ()
void PutCh (const uchar &_Ch)
void PutStr (const TStr &Str)
void ToNrSpacing ()
void GetWs (const bool &IsRq)
TStr GetReference ()
void GetEq ()
TStr GetName ()
TStr GetName (const TStr &RqNm)
void GetComment ()
TStr GetAttValue ()
TStr GetVersionNum ()
TStr GetEncName ()
TStr GetStalVal ()
void GetXmlDecl ()
void GetPI ()
TStr GetSystemLiteral ()
TStr GetPubidLiteral ()
TStr GetPEReference ()
void GetExternalId ()
void GetNData ()
void GetDocTypeDecl ()
void GetElement ()
void GetAttList ()
TStr GetEntityValue ()
void GetEntity ()
void GetNotation ()
void GetCDSect ()

Private Attributes

PSIn SIn
TSInRSIn
TChA ChStack
uchar PrevCh
uchar Ch
int LnN
int LnChN
int ChN
TXmlSpacing Spacing
TStrStrH EntityNmToValH
TStrStrH PEntityNmToValH

Static Private Attributes

static TXmlChDef ChDef

Detailed Description

Definition at line 98 of file xml.h.


Constructor & Destructor Documentation

TXmlLx::TXmlLx ( const PSIn _SIn,
const TXmlSpacing _Spacing = xspIntact 
) [inline]

Definition at line 145 of file xml.h.

References GetCh().

                                                                 :
    SIn(_SIn), RSIn(*SIn),
    ChStack(), PrevCh(' '), Ch(' '),
    LnN(1), LnChN(0), ChN(0), Spacing(_Spacing),
    EntityNmToValH(100), PEntityNmToValH(100),
    Sym(xsyUndef), TxtChA(), TagNm(), ArgNmValKdV(10){GetCh();}

Here is the call graph for this function:


Member Function Documentation

void TXmlLx::AddArg ( const TStr ArgNm,
const TStr ArgVal 
) [inline]

Definition at line 161 of file xml.h.

References TVec< TVal, TSizeTy >::Add(), and ArgNmValKdV.

Referenced by GetSym(), and GetXmlDecl().

                                                    {
    ArgNmValKdV.Add(TStrKd(ArgNm, ArgVal));}

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlLx::ClrArgV ( ) [inline]

Definition at line 160 of file xml.h.

References ArgNmValKdV, and TVec< TVal, TSizeTy >::Clr().

Referenced by GetSym().

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlLx::EThrow ( const TStr MsgStr) const

Definition at line 885 of file xml.cpp.

References TSBase::GetSNm(), TInt::GetStr(), LnChN, LnN, SIn, and TExcept::Throw().

Referenced by GetAttList(), GetAttValue(), GetCDSect(), GetComment(), GetDocTypeDecl(), GetElement(), GetEncName(), GetEntity(), GetEntityValue(), GetEq(), GetExternalId(), GetName(), GetNotation(), GetPEReference(), GetPI(), GetPubidLiteral(), GetReference(), GetStalVal(), GetSym(), GetSystemLiteral(), GetVersionNum(), GetWs(), GetXmlDecl(), and TXmlDoc::LoadTxtElement().

                                            {
  TChA FPosChA;
  FPosChA+=" [File:"; FPosChA+=SIn->GetSNm();
  FPosChA+=" Line:"; FPosChA+=TInt::GetStr(LnN);
  FPosChA+=" Char:"; FPosChA+=TInt::GetStr(LnChN);
  FPosChA+="]";
  TStr FullMsgStr=MsgStr+FPosChA;
  TExcept::Throw(FullMsgStr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlLx::GetArg ( const int &  ArgN,
TStr ArgNm,
TStr ArgVal 
) const [inline]

Definition at line 166 of file xml.h.

References ArgNmValKdV.

Referenced by GetSymStr(), TSnap::LoadDyNet(), and TSnap::LoadDyNetGraphV().

                                                                {
    ArgNm=ArgNmValKdV[ArgN].Key; ArgVal=ArgNmValKdV[ArgN].Dat;}

Here is the caller graph for this function:

int TXmlLx::GetArgs ( ) const [inline]

Definition at line 165 of file xml.h.

References ArgNmValKdV, and TVec< TVal, TSizeTy >::Len().

Referenced by GetSymStr().

{return ArgNmValKdV.Len();}

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TXmlLx::GetArgVal ( const TStr ArgNm,
const TStr DfVal = TStr() 
) const [inline]

Definition at line 168 of file xml.h.

References ArgNmValKdV, and TVec< TVal, TSizeTy >::SearchForw().

                                                                    {
    int ArgN=ArgNmValKdV.SearchForw(TStrKd(ArgNm));
    if (ArgN==-1){return DfVal;} else {return ArgNmValKdV[ArgN].Dat;}}

Here is the call graph for this function:

static char TXmlLx::GetArgValQCh ( const TStr ArgVal) [inline, static]

Definition at line 171 of file xml.h.

References TStr::IsChIn().

Referenced by TXmlTok::AddTokToChA(), and GetSymStr().

                                              {
    if (ArgVal.IsChIn('\"')){return '\'';} else {return '\"';}}

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlLx::GetAttList ( ) [private]

Definition at line 665 of file xml.cpp.

References Ch, ChDef, TChA::Clr(), EThrow(), GetCh(), TXmlChDef::IsChar(), and TxtChA.

Referenced by GetSym().

                       {
  TxtChA.Clr();
  while (Ch!='>'){
    if (!ChDef.IsChar(Ch)){EThrow("Invalid Element character.");}
    TxtChA+=Ch; GetCh();
  }
  GetCh();
}

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TXmlLx::GetAttValue ( ) [private]

Definition at line 457 of file xml.cpp.

References Ch, ChDef, EThrow(), forever, GetCh(), GetReference(), and TXmlChDef::IsChar().

Referenced by GetSym().

                        {
  // [10]  AttValue ::=  '"' ([^<&"] | Reference)* '"'
  //  |  "'" ([^<&'] | Reference)* "'"
  uchar QCh=Ch;
  if ((QCh!='"')&&(QCh!='\'')){EThrow("Invalid attribute-value start.");}
  TChA ValChA; GetCh();
  forever {
    if ((Ch=='<')||(!ChDef.IsChar(Ch))){
      EThrow("Invalid attribute-value character.");}
    if (Ch==QCh){GetCh(); break;} // final quote
    else if (Ch=='&'){GetCh(); ValChA+=GetReference();} // reference
    else {ValChA+=Ch; GetCh();} // usual char
  }
  return ValChA;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlLx::GetCDSect ( ) [private]

Definition at line 733 of file xml.cpp.

References Ch, ChDef, TChA::Clr(), EThrow(), forever, GetCh(), TXmlChDef::IsChar(), TChA::LastCh(), TChA::LastLastCh(), TChA::Len(), TChA::Pop(), and TxtChA.

Referenced by GetSym().

                      {
  // [18]  CDSect ::=  CDStart CData CDEnd
  // [19]  CDStart ::=  '<![CDATA{{['}}
  // [20]  CData ::=  (Char* - (Char* ']]>' Char*))
  // [21]  CDEnd ::=  ']]>'
  if (Ch=='['){GetCh();}
  else {EThrow("Invalid start of CDATA section.");}
  TxtChA.Clr();
  forever {
    if (!ChDef.IsChar(Ch)){EThrow("Invalid CDATA character.");}
    if ((Ch=='>')&&(TxtChA.Len()>=2)&&
     (TxtChA.LastLastCh()==']') && (TxtChA.LastCh()==']')){
      GetCh(); TxtChA.Pop(); TxtChA.Pop(); break;
    } else {
      TxtChA+=Ch; GetCh();
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

uchar TXmlLx::GetCh ( ) [private]
TStr TXmlLx::GetChRefFromYuEntRef ( const TStr YuEntRefStr) [static]

Definition at line 1072 of file xml.cpp.

References TStr::ChangeStrAll().

                                                        {
  TStr ChRefStr=YuEntRefStr;
  ChRefStr.ChangeStrAll("&ch;", "&#232;");
  ChRefStr.ChangeStrAll("&Ch;", "&#200;");
  ChRefStr.ChangeStrAll("&sh;", "&#154;");
  ChRefStr.ChangeStrAll("&Sh;", "&#138;");
  ChRefStr.ChangeStrAll("&zh;", "&#158;");
  ChRefStr.ChangeStrAll("&Zh;", "&#142;");
  ChRefStr.ChangeStrAll("&cs", "c");
  ChRefStr.ChangeStrAll("&Cs;", "C");
  ChRefStr.ChangeStrAll("&dz;", "dz");
  ChRefStr.ChangeStrAll("&Dz;", "Dz");
  return ChRefStr;
}

Here is the call graph for this function:

void TXmlLx::GetComment ( ) [private]

Definition at line 436 of file xml.cpp.

References Ch, ChDef, TChA::Clr(), EThrow(), forever, GetCh(), TXmlChDef::IsChar(), and TxtChA.

Referenced by GetSym().

                       {
  // [15] Comment ::=  {{'<!-}}-' ((Char - '-') | ('-' (Char - '-')))* '-->'
  if (GetCh()!='-'){EThrow("Invalid comment start.");}
  TxtChA.Clr();
  forever {
    GetCh();
    if (!ChDef.IsChar(Ch)){EThrow("Invalid comment character.");}
    if (Ch=='-'){
      if (GetCh()=='-'){
        if (GetCh()=='>'){GetCh(); break;} // final bracket
        else {EThrow("Invalid comment end.");}
      } else {
        if (!ChDef.IsChar(Ch)){EThrow("Invalid comment character.");}
        TxtChA+='-'; TxtChA+=Ch; // special case if single '-'
      }
    } else {
      TxtChA+=Ch; // usual char
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlLx::GetDocTypeDecl ( ) [private]

Definition at line 627 of file xml.cpp.

References Ch, ChDef, EThrow(), GetCh(), GetExternalId(), GetName(), GetPEReference(), GetSym(), GetWs(), TXmlChDef::IsWs(), and TagNm.

Referenced by GetSym().

                           {
  // [28] doctypedecl ::=  {{'<!DOCTYPE'}} S Name (S ExternalID)? S?
  //  ('[' (markupdecl | PEReference | S)* ']' S?)? '>'
  GetWs(true);
  TStr DocTypeDeclNm=GetName();
  GetWs(false);
  if (Ch=='>'){GetCh(); return;}
  if (Ch!='['){GetExternalId();}
  GetWs(false);
  if (Ch=='['){
    GetCh();
    // [28] (markupdecl | PEReference | S)*
    GetWs(false);
    while (Ch!=']'){
      if (ChDef.IsWs(Ch)){GetWs(true);}
      else if (Ch=='%'){GetPEReference();}
      else {
        GetSym();
      }
    }
    GetCh();
  }
  GetWs(false);
  // '>'
  if (Ch=='>'){GetCh();}
  else {EThrow("Invalid end-of-tag in document-type-declaration.");}
  TagNm=DocTypeDeclNm;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlLx::GetElement ( ) [private]

Definition at line 656 of file xml.cpp.

References Ch, ChDef, TChA::Clr(), EThrow(), GetCh(), TXmlChDef::IsChar(), and TxtChA.

Referenced by GetSym().

                       {
  TxtChA.Clr();
  while (Ch!='>'){
    if (!ChDef.IsChar(Ch)){EThrow("Invalid Element character.");}
    TxtChA+=Ch; GetCh();
  }
  GetCh();
}

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TXmlLx::GetEncName ( ) [private]

Definition at line 493 of file xml.cpp.

References Ch, EThrow(), and GetCh().

Referenced by GetXmlDecl().

                       {
  // [80] EncodingDecl ::=  {{S 'encoding' Eq}} ('"' EncName '"' |  "'" EncName "'" )
  // [81] EncName ::=  [A-Za-z] ([A-Za-z0-9._] | '-')*
  char QCh=Ch;
  if ((Ch!='\'')&&(Ch!='"')){EThrow("Quote character (' or \") expected.");}
  TChA EncNmChA;
  GetCh();
  if ((('a'<=Ch)&&(Ch<='z'))||(('A'<=Ch)&&(Ch<='Z'))){EncNmChA+=Ch;}
  else {EThrow("Invalid encoding-name character.");}
  GetCh();
  while (Ch!=QCh){
    if ((('a'<=Ch)&&(Ch<='z'))||(('A'<=Ch)&&(Ch<='Z'))||
     (('0'<=Ch)&&(Ch<='9'))||(Ch=='.')||(Ch=='_')||(Ch=='-')){EncNmChA+=Ch;}
    else {EThrow("Invalid version-number character.");}
    GetCh();
  }
  GetCh();
  return EncNmChA;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlLx::GetEntity ( ) [private]

Definition at line 690 of file xml.cpp.

References Ch, EThrow(), GetCh(), GetEntityValue(), GetExternalId(), GetName(), GetNData(), GetWs(), PutEntityVal(), PutPEntityVal(), and TagNm.

Referenced by GetSym().

                      {
  // [70] EntityDecl ::=  GEDecl | PEDecl
  // [71] GEDecl ::=  '<!ENTITY' S Name S EntityDef S? '>'
  // [72] PEDecl ::=  '<!ENTITY' S '%' S Name S PEDef S? '>'
  GetWs(true); TStr EntityNm;
  if (Ch=='%'){
    GetCh(); GetWs(true); EntityNm=GetName(); GetWs(true);
    // [74] PEDef ::=  EntityValue | ExternalID
    if ((Ch=='\"')||(Ch=='\'')){
      TStr EntityVal=GetEntityValue();
      PutPEntityVal(EntityNm, EntityVal);
    } else {
      GetExternalId();
      GetWs(false);
      if (Ch!='>'){GetNData();}
    }
  } else {
    EntityNm=GetName(); GetWs(true);
    // [73] EntityDef ::=  EntityValue | (ExternalID NDataDecl?)
    if ((Ch=='\"')||(Ch=='\'')){
      TStr EntityVal=GetEntityValue();
      PutEntityVal(EntityNm, EntityVal);
    } else {
      GetExternalId();
    }
  }
  GetWs(false);
  if (Ch=='>'){GetCh();}
  else {EThrow("Invalid end-of-tag in entity-declaration.");}
  TagNm=EntityNm;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 674 of file xml.cpp.

References Ch, ChDef, EThrow(), forever, GetCh(), GetPEReference(), GetReference(), and TXmlChDef::IsChar().

Referenced by GetEntity().

                           {
  // [9]  EntityValue ::=  '"' ([^%&"] | PEReference | Reference)* '"'
  //  | "'" ([^%&'] | PEReference | Reference)* "'"
  uchar QCh=Ch;
  if ((QCh!='"')&&(QCh!='\'')){EThrow("Invalid entity-value start.");}
  TChA ValChA; GetCh();
  forever {
    if (!ChDef.IsChar(Ch)){EThrow("Invalid entity-value character.");}
    if (Ch==QCh){GetCh(); break;} // final quote
    else if (Ch=='&'){GetCh(); ValChA+=GetReference();} // reference
    else if (Ch=='%'){GetCh(); ValChA+=GetPEReference();} // pereference
    else {ValChA+=Ch; GetCh();} // usual char
  }
  return ValChA;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlLx::GetEq ( ) [private]

Definition at line 408 of file xml.cpp.

References Ch, EThrow(), GetCh(), and GetWs().

Referenced by GetSym(), and GetXmlDecl().

                  {
  // [25] Eq ::=  S? '=' S?
  GetWs(false);
  if (Ch=='='){GetCh();}
  else {EThrow("Equality ('=') character expected.");}
  GetWs(false);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlLx::GetExternalId ( ) [private]

Definition at line 609 of file xml.cpp.

References EThrow(), GetName(), GetPubidLiteral(), GetSystemLiteral(), and GetWs().

Referenced by GetDocTypeDecl(), and GetEntity().

                          {
  // ExternalID ::=  'SYSTEM' S SystemLiteral
  //  | 'PUBLIC' S PubidLiteral S SystemLiteral
  TStr ExtIdNm=GetName();
  if (ExtIdNm=="SYSTEM"){
    GetWs(true); GetSystemLiteral();
  } else if (ExtIdNm=="PUBLIC"){
    GetWs(true); GetPubidLiteral(); GetWs(true); GetSystemLiteral();
  } else {
    EThrow("Invalid external-id ('SYSTEM' or 'PUBLIC' expected).");
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 895 of file xml.cpp.

References TSBase::GetSNm(), TInt::GetStr(), LnChN, LnN, and SIn.

                              {
  TChA FPosChA;
  FPosChA+=" [File:"; FPosChA+=SIn->GetSNm();
  FPosChA+=" Line:"; FPosChA+=TInt::GetStr(LnN);
  FPosChA+=" Char:"; FPosChA+=TInt::GetStr(LnChN);
  FPosChA+="]";
  return FPosChA;
}

Here is the call graph for this function:

TStr TXmlLx::GetName ( ) [private]

Definition at line 416 of file xml.cpp.

References Ch, ChDef, EThrow(), GetCh(), TXmlChDef::IsFirstNameCh(), and TXmlChDef::IsName().

Referenced by GetDocTypeDecl(), GetEntity(), GetExternalId(), GetName(), GetNData(), GetPEReference(), GetReference(), GetSym(), and GetXmlDecl().

                    {
  // [5] Name ::=  (Letter | '_' | ':') (NameChar)*
  TChA NmChA;
  if (ChDef.IsFirstNameCh(Ch)){
    do {NmChA+=Ch;} while (ChDef.IsName(GetCh()));
  } else {
    EThrow("Invalid first name character.");
    // EThrow(TStr::Fmt("Invalid first name character [%u:'%c%c%c%c%c'].", 
    //  uint(Ch), Ch, RSIn.GetCh(), RSIn.GetCh(), RSIn.GetCh(), RSIn.GetCh()));
  }
  return NmChA;
}

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TXmlLx::GetName ( const TStr RqNm) [private]

Definition at line 429 of file xml.cpp.

References EThrow(), Fail, and GetName().

                                    {
  TStr Nm=GetName();
  // test if the name is equal to the required name
  if (Nm==RqNm){return RqNm;}
  else {EThrow(TStr("Name '")+RqNm+"' expected."); Fail; return TStr();}
}

Here is the call graph for this function:

void TXmlLx::GetNData ( ) [private]

Definition at line 622 of file xml.cpp.

References GetName(), and GetWs().

Referenced by GetEntity().

                     {
  // [76]  NDataDecl ::=  S 'NDATA' S Name
  GetName("NDATA"); GetWs(true); GetName();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlLx::GetNotation ( ) [private]

Definition at line 722 of file xml.cpp.

References Ch, ChDef, TChA::Clr(), EThrow(), GetCh(), TXmlChDef::IsChar(), and TxtChA.

Referenced by GetSym().

                        {
  // [82] NotationDecl ::=  '<!NOTATION' S Name S (ExternalID |  PublicID) S? '>'
  // [83]  PublicID ::=  'PUBLIC' S PubidLiteral
  TxtChA.Clr();
  while (Ch!='>'){
    if (!ChDef.IsChar(Ch)){EThrow("Invalid Element character.");}
    TxtChA+=Ch; GetCh();
  }
  GetCh();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 397 of file xml.cpp.

References Ch, TStr::Empty(), EThrow(), GetCh(), GetName(), and IsPEntityNm().

Referenced by GetDocTypeDecl(), and GetEntityValue().

                           {
  // [69]  PEReference ::=  '%' Name ';'
  TStr EntityNm=GetName();
  if ((EntityNm.Empty())||(Ch!=';')){EThrow("Invalid PEntity-Reference.");}
  GetCh();
  TStr EntityVal;
  if (IsPEntityNm(EntityNm, EntityVal)){/*intentionaly empty*/}
  else {EThrow(TStr("PEntity-Reference (")+EntityNm+") does not exist.");}
  return EntityVal;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlLx::GetPI ( ) [private]

Definition at line 562 of file xml.cpp.

References Ch, ChDef, TChA::Clr(), EThrow(), forever, GetCh(), GetWs(), TXmlChDef::IsChar(), and TxtChA.

Referenced by GetSym().

                  {
  // [16]  PI ::=  {{'<?' PITarget}} (S (Char* - (Char* '?>' Char*)))? '?>'
  // [17]  PITarget ::=  Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))
  GetWs(false);
  TxtChA.Clr();
  forever {
    if (!ChDef.IsChar(Ch)){EThrow("Invalid PI character.");}
    if (Ch=='?'){
      if (GetCh()=='>'){
        GetCh(); break;
      } else {
        if (!ChDef.IsChar(Ch)){EThrow("Invalid PI character.");}
        TxtChA+='?'; TxtChA+=Ch; // special case if single '?'
      }
    } else {
      TxtChA+=Ch; // usual char
    }
    GetCh();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TXmlLx::GetPlainStrFromXmlStr ( const TStr XmlStr) [static]

Definition at line 991 of file xml.cpp.

References Ch, TChA::Empty(), TUnicode::EncodeUtf8(), TChRet::Eof(), forever, TChRet::GetCh(), TCh::GetHex(), TCh::GetNum(), TCh::IsHex(), TCh::IsNum(), and TStrIn::New().

Referenced by GetUsAsciiStrFromXmlStr().

                                                    {
  TChA PlainChA;
  TChRet Ch(TStrIn::New(XmlStr));
  Ch.GetCh();
  while (!Ch.Eof()){
    if (Ch()!='&'){
      PlainChA+=Ch(); Ch.GetCh();
    } else {
      // [67] Reference ::=  EntityRef | CharRef
      if (Ch.GetCh()=='#'){
        // [66]  CharRef ::=  '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';'
        TChA RefChA; int RefCd=0;
        if (Ch.GetCh()=='x'){
          // hex-decimal character code
          forever {
            Ch.GetCh();
            if (TCh::IsHex(Ch())){
              RefChA+=Ch();
              RefCd=RefCd*16+TCh::GetHex(Ch());
            } else {
              break;
            }
          }
        } else {
          // decimal character code
          forever {
            if (TCh::IsNum(Ch())){
              RefChA+=Ch();
              RefCd=RefCd*10+TCh::GetNum(Ch());
            } else {
              break;
            }
            Ch.GetCh();
          }
        }
        if ((!RefChA.Empty())&&(Ch()==';')){
          Ch.GetCh();
                  if (RefCd < 0x80) {
                        // ascii character
                        uchar RefCh=uchar(RefCd);
                        PlainChA+=RefCh;
                  } else {
                        // unicode
                        TUnicode::EncodeUtf8(RefCd, PlainChA);
                  }
        }
      } else {
        // [68]  EntityRef ::=  '&' Name ';'
        TChA EntityNm;
        while ((!Ch.Eof())&&(Ch()!=';')){
          EntityNm+=Ch(); Ch.GetCh();}
        if ((!EntityNm.Empty())&&(Ch()==';')){
          Ch.GetCh();
          if (EntityNm=="quot"){PlainChA+='"';}
          else if (EntityNm=="amp"){PlainChA+='&';}
          else if (EntityNm=="apos"){PlainChA+='\'';}
          else if (EntityNm=="lt"){PlainChA+='<';}
          else if (EntityNm=="gt"){PlainChA+='>';}
        }
      }
    }
  }
  return PlainChA;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 596 of file xml.cpp.

References Ch, ChDef, EThrow(), GetCh(), and TXmlChDef::IsPubid().

Referenced by GetExternalId().

                            {
  // [12]  PubidLiteral ::=  '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
  char QCh=Ch;
  if ((Ch!='\'')&&(Ch!='"')){EThrow("Quote character (' or \") expected.");}
  TChA LitChA; GetCh();
  while (Ch!=QCh){
    if (!ChDef.IsPubid(Ch)){EThrow("Invalid Public-Id-Literal character.");}
    LitChA+=Ch; GetCh();
  }
  GetCh();
  return LitChA;
}

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TXmlLx::GetReference ( ) [private]

Definition at line 340 of file xml.cpp.

References Ch, ChDef, TChA::Empty(), TStr::Empty(), TUnicode::EncodeUtf8(), EThrow(), Fail, forever, GetCh(), TCh::GetHex(), GetName(), TCh::GetNum(), TXmlChDef::IsEntityNm(), IsEntityNm(), TCh::IsHex(), and TCh::IsNum().

Referenced by GetAttValue(), GetEntityValue(), and GetSym().

                         {
  // [67] Reference ::=  EntityRef | CharRef
  if (Ch=='#'){
    // [66]  CharRef ::=  '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';'
    TChA RefChA; int RefCd=0;
    if (GetCh()=='x'){
      // hex-decimal character code
      forever {
        GetCh();
        if (TCh::IsHex(Ch)){
          RefChA+=Ch;
          RefCd=RefCd*16+TCh::GetHex(Ch);
        } else {
          break;
        }
      }
    } else {
      // decimal character code
      forever {
        if (TCh::IsNum(Ch)){
          RefChA+=Ch;
          RefCd=RefCd*10+TCh::GetNum(Ch);
        } else {
          break;
        }
        GetCh();
      }
    }
    if ((!RefChA.Empty())&&(Ch==';')){
      GetCh();
          if (RefCd < 0x80) {
                  // 8-bit char
              uchar RefCh=uchar(RefCd);
                  return TStr(RefCh);
          } else {
                  TStr ResStr = TUnicode::EncodeUtf8(RefCd);
                  return ResStr;
          }
    } else {
      EThrow("Invalid Char-Reference."); Fail; return TStr();
    }
  } else {
    // [68]  EntityRef ::=  '&' Name ';'
    TStr EntityNm=GetName();
    if ((!EntityNm.Empty())&&(Ch==';')){
      GetCh();
      TStr EntityVal;
      if (IsEntityNm(EntityNm, EntityVal)){/*intentionaly empty*/}
      else if (ChDef.IsEntityNm(EntityNm, EntityVal)){/*intentionaly empty*/}
      else {EThrow(TStr("Entity-Reference (")+EntityNm+") does not exist.");}
      return EntityVal;
    } else {
      EThrow("Invalid Entity-Reference."); Fail; return TStr();
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TXmlLx::GetStalVal ( ) [private]

Definition at line 513 of file xml.cpp.

References Ch, EThrow(), Fail, and GetCh().

Referenced by GetXmlDecl().

                       {
  // [32] SDDecl ::=  {{S 'standalone' Eq}}
  //  (("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"'))
  char QCh=Ch;
  if ((Ch!='\'')&&(Ch!='"')){EThrow("Quote character (' or \") expected.");}
  TChA StalChA;
  GetCh();
  while (Ch!=QCh){
    if (('a'<=Ch)&&(Ch<='z')){StalChA+=Ch;}
    else {EThrow("Invalid standalone-value character.");}
    GetCh();
  }
  GetCh();
  TStr StalVal=StalChA;
  if ((StalVal=="yes")||(StalVal=="no")){return StalVal;}
  else {EThrow("Invalid standalone-value."); Fail; return TStr();}
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 757 of file xml.cpp.

References AddArg(), Ch, ChDef, TChA::Clr(), ClrArgV(), TCh::EofCh, EThrow(), forever, GetAttList(), GetAttValue(), GetCDSect(), GetCh(), GetComment(), GetDocTypeDecl(), GetElement(), GetEntity(), GetEq(), TStr::GetLc(), GetName(), GetNotation(), GetPI(), GetReference(), TUInt::GetStr(), GetWs(), GetXmlDecl(), TXmlChDef::IsChar(), TXmlChDef::IsWs(), TChA::LastCh(), TChA::LastLastCh(), TChA::Len(), SkipWs(), Spacing, Sym, TagNm, ToNrSpacing(), TxtChA, xspTruncate, xsyAttList, xsyComment, xsyDocTypeDecl, xsyElement, xsyEntity, xsyEof, xsyETag, xsyNotation, xsyPI, xsyQStr, xsySETag, xsySTag, xsyStr, xsyWs, and xsyXmlDecl.

Referenced by GetDocTypeDecl(), TStrUtil::GetXmlTagNmVal(), TStrUtil::GetXmlTagNmVal2(), TStrUtil::GetXmlTagVal(), TSnap::LoadDyNet(), TSnap::LoadDyNetGraphV(), TXmlDoc::LoadTxt(), TXmlDoc::LoadTxtElement(), TXmlDoc::LoadTxtMiscStar(), and TXmlDoc::SkipTopTag().

                        {
  if (Ch=='<'){
    GetCh(); ClrArgV();
    if (Ch=='?'){
      GetCh(); TagNm=GetName();
      if (TagNm.GetLc()=="xml"){Sym=xsyXmlDecl; GetXmlDecl();}
      else {Sym=xsyPI; GetPI();}
    } else
    if (Ch=='!'){
      GetCh();
      if (Ch=='['){
        GetCh(); TagNm=GetName();
        if (TagNm=="CDATA"){Sym=xsyQStr; GetCDSect();}
        else {EThrow(TStr("Invalid tag after '<![' (")+TagNm+").");}
      } else
      if (Ch=='-'){
        Sym=xsyComment; GetComment();
      } else {
        TagNm=GetName();
        if (TagNm=="DOCTYPE"){GetDocTypeDecl(); Sym=xsyDocTypeDecl;}
        else if (TagNm=="ELEMENT"){GetElement(); Sym=xsyElement;}
        else if (TagNm=="ATTLIST"){GetAttList(); Sym=xsyAttList;}
        else if (TagNm=="ENTITY"){GetEntity(); Sym=xsyEntity;}
        else if (TagNm=="NOTATION"){GetNotation(); Sym=xsyNotation;}
        else {EThrow(TStr("Invalid tag (")+TagNm+").");}
      }
    } else
    if (Ch=='/'){
      // xsyETag
      GetCh(); Sym=xsyETag; TagNm=GetName(); GetWs(false);
      if (Ch=='>'){GetCh();}
      else {EThrow("Invalid End-Tag.");}
    } else {
      // xsySTag or xsySETag
      TagNm=GetName(); GetWs(false);
      while ((Ch!='>')&&(Ch!='/')){
        TStr AttrNm=GetName();
        GetEq();
        TStr AttrVal=GetAttValue();
        GetWs(false);
        AddArg(AttrNm, AttrVal);
      }
      if (Ch=='/'){
        if (GetCh()=='>'){Sym=xsySETag; GetCh();}
        else {EThrow("Invalid Empty-Element-Tag.");}
      } else {
        Sym=xsySTag; GetCh();
      }
    }
    if (Spacing==xspTruncate){SkipWs();}
  } else
  if (ChDef.IsWs(Ch)){
    Sym=xsyWs; GetWs(true); ToNrSpacing();
    if (Spacing==xspTruncate){GetSym();}
  } else
  if (Ch==TCh::EofCh){
    Sym=xsyEof;
  } else {
    Sym=xsyStr; TxtChA.Clr();
    // [14]  CharData ::=  [^<&]* - ([^<&]* ']]>' [^<&]*)
    forever {
      if (!ChDef.IsChar(Ch)){
        EThrow(TUInt::GetStr(Ch, "Invalid character (%d)."));}
                // GetCh();  continue; // skip invalid characters
      if (Ch=='<'){break;} // tag
      if (Ch=='&'){GetCh(); TxtChA+=GetReference();} // reference
      else {
        if ((Ch=='>')&&(TxtChA.Len()>=2)&&
         (TxtChA.LastLastCh()==']')&&(TxtChA.LastCh()==']')){
          EThrow("Forbidden substring ']]>' in character data.");}
        TxtChA+=Ch; GetCh(); // usual char
      }
    }
    ToNrSpacing();
  }
  return Sym;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 835 of file xml.cpp.

References TChA::Empty(), Fail, GetArg(), GetArgs(), GetArgValQCh(), TStr::GetHex(), Sym, TagNm, TxtChA, xsyComment, xsyDocTypeDecl, xsyEof, xsyETag, xsyPI, xsyQStr, xsySETag, xsySTag, xsyStr, xsyUndef, xsyWs, and xsyXmlDecl.

                             {
  TChA SymChA;
  switch (Sym){
    case xsyUndef:
      SymChA="{Undef}"; break;
    case xsyWs:
      SymChA+="{Space:'"; SymChA+=TStr(TxtChA).GetHex(); SymChA+="'}"; break;
    case xsyComment:
      SymChA+="<!--"; SymChA+=TxtChA; SymChA+="-->"; break;
    case xsyXmlDecl:{
      SymChA+="<?"; SymChA+=TagNm;
      for (int ArgN=0; ArgN<GetArgs(); ArgN++){
        TStr ArgNm; TStr ArgVal; GetArg(ArgN, ArgNm, ArgVal);
        char ArgValQCh=GetArgValQCh(ArgVal);
        SymChA+=' '; SymChA+=ArgNm; SymChA+='=';
        SymChA+=ArgValQCh; SymChA+=ArgVal; SymChA+=ArgValQCh;
      }
      SymChA+="?>"; break;}
    case xsyPI:
      SymChA+="<?"; SymChA+=TagNm;
      if (!TxtChA.Empty()){SymChA+=' '; SymChA+=TxtChA;}
      SymChA+="?>"; break;
    case xsyDocTypeDecl:
      SymChA+="<!DOCTYPE "; SymChA+=TagNm; SymChA+=">"; break;
    case xsySTag:
    case xsySETag:{
      SymChA+="<"; SymChA+=TagNm;
      for (int ArgN=0; ArgN<GetArgs(); ArgN++){
        TStr ArgNm; TStr ArgVal; GetArg(ArgN, ArgNm, ArgVal);
        char ArgValQCh=GetArgValQCh(ArgVal);
        SymChA+=' '; SymChA+=ArgNm; SymChA+='=';
        SymChA+=ArgValQCh; SymChA+=ArgVal; SymChA+=ArgValQCh;
      }
      if (Sym==xsySTag){SymChA+=">";}
      else if (Sym==xsySETag){SymChA+="/>";}
      else {Fail;}
      break;}
    case xsyETag:
      SymChA+="</"; SymChA+=TagNm; SymChA+=">"; break;
    case xsyStr:
      SymChA="{String:'"; SymChA+=TxtChA; SymChA+="'}"; break;
    case xsyQStr:
      SymChA="{QString:'"; SymChA+=TxtChA; SymChA+="'}"; break;
    case xsyEof:
      SymChA="{Eof}"; break;
    default: Fail;
  }
  return SymChA;
}

Here is the call graph for this function:

Definition at line 583 of file xml.cpp.

References Ch, ChDef, EThrow(), GetCh(), and TXmlChDef::IsChar().

Referenced by GetExternalId().

                             {
  // [11]  SystemLiteral ::=  ('"' [^"]* '"') | ("'" [^']* "'")
  char QCh=Ch;
  if ((Ch!='\'')&&(Ch!='"')){EThrow("Quote character (' or \") expected.");}
  TChA LitChA; GetCh();
  while (Ch!=QCh){
    if (!ChDef.IsChar(Ch)){EThrow("Invalid System-Literal character.");}
    LitChA+=Ch; GetCh();
  }
  GetCh();
  return LitChA;
}

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TXmlLx::GetUsAsciiStrFromXmlStr ( const TStr EntRefStr) [static]

Definition at line 1056 of file xml.cpp.

References Ch, TStr::ChangeStrAll(), ChN, GetPlainStrFromXmlStr(), TChA::Len(), and TChA::PutCh().

                                                      {
  TStr UsAsciiStr=XmlStr;
  UsAsciiStr.ChangeStrAll("&#232;", "c");
  UsAsciiStr.ChangeStrAll("&#200;", "C");
  UsAsciiStr.ChangeStrAll("&#154;", "s");
  UsAsciiStr.ChangeStrAll("&#138;", "S");
  UsAsciiStr.ChangeStrAll("&#158;", "z");
  UsAsciiStr.ChangeStrAll("&#142;", "Z");
  TChA UsAsciiChA=TXmlLx::GetPlainStrFromXmlStr(UsAsciiStr);
  for (int ChN=0; ChN<UsAsciiChA.Len(); ChN++){
    char Ch=UsAsciiChA[ChN];
    if ((Ch<' ')||('~'<Ch)){UsAsciiChA.PutCh(ChN, 'x');}
  }
  return UsAsciiChA;
}

Here is the call graph for this function:

TStr TXmlLx::GetVersionNum ( ) [private]

Definition at line 473 of file xml.cpp.

References Ch, EThrow(), and GetCh().

Referenced by GetXmlDecl().

                          {
  // [24] VersionInfo ::=  {{S 'version' Eq}} (' VersionNum ' | " VersionNum ")
  // [26] VersionNum ::=  ([a-zA-Z0-9_.:] | '-')+
  char QCh=Ch;
  if ((Ch!='\'')&&(Ch!='"')){EThrow("Quote character (' or \") expected.");}
  TChA VerNumChA;
  GetCh();
  do {
    if ((('a'<=Ch)&&(Ch<='z'))||(('A'<=Ch)&&(Ch<='Z'))||
     (('0'<=Ch)&&(Ch<='9'))||(Ch=='_')||(Ch=='.')||(Ch==':')||(Ch=='-')){
      VerNumChA+=Ch;
    } else {
      EThrow("Invalid version-number character.");
    }
    GetCh();
  } while (Ch!=QCh);
  GetCh();
  return VerNumChA;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlLx::GetWs ( const bool &  IsRq) [private]

Definition at line 331 of file xml.cpp.

References Ch, ChDef, TChA::Clr(), EThrow(), GetCh(), TXmlChDef::IsWs(), and TxtChA.

Referenced by GetDocTypeDecl(), GetEntity(), GetEq(), GetExternalId(), GetNData(), GetPI(), GetSym(), and GetXmlDecl().

                                  {
  // [3] S ::=  (#x20 | #x9 | #xD | #xA)+
  int WSpaces=0; TxtChA.Clr();
  while (ChDef.IsWs(Ch)){
    WSpaces++; TxtChA+=Ch; GetCh();}
  if (IsRq&&(WSpaces==0)){
    EThrow("White-space required.");}
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlLx::GetXmlDecl ( ) [private]

Definition at line 531 of file xml.cpp.

References AddArg(), Ch, EThrow(), GetCh(), GetEncName(), GetEq(), GetName(), GetStalVal(), GetVersionNum(), and GetWs().

Referenced by GetSym().

                       {
  // [23] XMLDecl ::=  {{'<?xml'}}... VersionInfo EncodingDecl? SDDecl? S? '?>'
  // [24] VersionInfo ::=  S 'version' Eq (' VersionNum ' | " VersionNum ")
  GetWs(true);
  TStr VerNm=GetName("version"); GetEq(); TStr VerVal=GetVersionNum();
  if (VerVal!="1.0"){EThrow("Invalid XML version.");}
  AddArg(VerNm, VerVal);
  GetWs(false);
  if (Ch!='?'){
    // EncodingDecl ::=  {{S}} 'encoding' Eq
    //  ('"' EncName '"' |  "'" EncName "'" )
    TStr EncNm=GetName("encoding"); GetEq(); TStr EncVal=GetEncName();
    AddArg(EncNm, EncVal);
  }
  GetWs(false);
  if (Ch!='?'){
    // SDDecl ::=  {{S}} 'standalone' Eq
    //  (("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"'))
    TStr StalNm=GetName("standalone"); GetEq(); TStr StalVal=GetStalVal();
    AddArg(StalNm, StalVal);
  }
  GetWs(false);
  if (Ch=='?'){
    GetCh();
    if (Ch=='>'){GetCh();}
    else {EThrow("Invalid end-of-tag in XML-declaration.");}
  } else {
    EThrow("Invalid end-of-tag in XML-declaration.");
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TXmlLx::GetXmlLxSymStr ( const TXmlLxSym XmlLxSym) [static]

Definition at line 904 of file xml.cpp.

References xsyAttList, xsyComment, xsyDocTypeDecl, xsyElement, xsyEntity, xsyEof, xsyETag, xsyNotation, xsyPI, xsyQStr, xsySETag, xsySTag, xsyStr, xsyTag, xsyUndef, xsyWs, and xsyXmlDecl.

Referenced by TXmlTok::GetSymStr().

                                                    {
  switch (XmlLxSym){
    case xsyUndef: return "Undef";
    case xsyWs: return "White-Space";
    case xsyComment: return "Comment";
    case xsyXmlDecl: return "Declaration";
    case xsyPI: return "PI";
    case xsyDocTypeDecl: return "Document-Type";
    case xsyElement: return "Element";
    case xsyAttList: return "Attribute-List";
    case xsyEntity: return "Entity";
    case xsyNotation: return "Notation";
    case xsyTag: return "Tag";
    case xsySTag: return "Start-Tag";
    case xsyETag: return "End-Tag";
    case xsySETag: return "Start-End-Tag";
    case xsyStr: return "String";
    case xsyQStr: return "Quoted-String";
    case xsyEof: return "Eon-Of-File";
    default: return "Undef";
  }
}

Here is the caller graph for this function:

TStr TXmlLx::GetXmlStrFromPlainMem ( const TMem PlainMem) [static]

Definition at line 945 of file xml.cpp.

References Ch, ChN, TUInt::GetStr(), and TMem::Len().

Referenced by TMem::SaveXml().

                                                      {
  TChA XmlChA;
  for (int ChN=0; ChN<PlainMem.Len(); ChN++){
    uchar Ch=PlainMem[ChN];
    if ((' '<=Ch)&&(Ch<='~')){
      switch (Ch){
        case '"': XmlChA+="&quot;"; break;
        case '&': XmlChA+="&amp;"; break;
        case '\'': XmlChA+="&apos;"; break;
        case '<': XmlChA+="&lt;"; break;
        case '>': XmlChA+="&gt;"; break;
        default: XmlChA+=Ch;
      }
    } else
    if ((Ch=='\r')||(Ch=='\n')){
      XmlChA+=Ch;
    } else {
      XmlChA+='&'; XmlChA+='#'; XmlChA+=TUInt::GetStr(Ch); XmlChA+=';';
    }
  }
  return XmlChA;
}

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TXmlLx::GetXmlStrFromPlainStr ( const TChA PlainChA) [static]

Definition at line 968 of file xml.cpp.

References Ch, ChN, TUInt::GetStr(), and TChA::Len().

Referenced by TXmlTok::AddTokToChA(), THtmlDoc::GetTxtLnDoc(), THtmlDoc::SaveHtmlToXml(), TChA::SaveXml(), and TStr::SaveXml().

                                                      {
  TChA XmlChA;
  for (int ChN=0; ChN<PlainChA.Len(); ChN++){
    uchar Ch=PlainChA[ChN];
    if ((' '<=Ch)&&(Ch<='~')){
      switch (Ch){
        case '"': XmlChA+="&quot;"; break;
        case '&': XmlChA+="&amp;"; break;
        case '\'': XmlChA+="&apos;"; break;
        case '<': XmlChA+="&lt;"; break;
        case '>': XmlChA+="&gt;"; break;
        default: XmlChA+=Ch;
      }
    } else
    if ((Ch=='\r')||(Ch=='\n')){
      XmlChA+=Ch;
    } else {
      XmlChA+='&'; XmlChA+='#'; XmlChA+=TUInt::GetStr(Ch); XmlChA+=';';
    }
  }
  return XmlChA;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TXmlLx::IsArgNm ( const TStr ArgNm) const [inline]

Definition at line 163 of file xml.h.

References ArgNmValKdV, and TVec< TVal, TSizeTy >::IsIn().

                                        {
    return ArgNmValKdV.IsIn(TStrKd(ArgNm));}

Here is the call graph for this function:

bool TXmlLx::IsEntityNm ( const TStr EntityNm,
TStr EntityVal 
) const [inline]

Definition at line 175 of file xml.h.

References EntityNmToValH, and THash< TKey, TDat, THashFunc >::IsKeyGetDat().

Referenced by GetReference().

                                                               {
    return EntityNmToValH.IsKeyGetDat(EntityNm, EntityVal);}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TXmlLx::IsPEntityNm ( const TStr EntityNm,
TStr EntityVal 
) const [inline]

Definition at line 179 of file xml.h.

References THash< TKey, TDat, THashFunc >::IsKeyGetDat(), and PEntityNmToValH.

Referenced by GetPEReference().

                                                                {
    return PEntityNmToValH.IsKeyGetDat(EntityNm, EntityVal);}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TXmlLx::IsTagNm ( const TStr Str) [static]

Definition at line 927 of file xml.cpp.

References ChN, and TChA::Len().

                                   {
  TChA ChA=Str;
  if (ChA.Len()>0){
    if (TXmlLx::ChDef.IsFirstNameCh(ChA[0])){
      for (int ChN=1; ChN<ChA.Len(); ChN++){
        if (!TXmlLx::ChDef.IsName(ChA[ChN])){
          return false;
        }
      }
      return true;
    } else {
      return false;
    }
  } else {
    return false;
  }
}

Here is the call graph for this function:

TXmlLx& TXmlLx::operator= ( const TXmlLx ) [inline]

Definition at line 152 of file xml.h.

References Fail.

{Fail; return *this;}
void TXmlLx::PutCh ( const uchar _Ch) [inline, private]

Definition at line 108 of file xml.h.

References Ch, ChStack, and TChA::Push().

Referenced by PutStr().

{ChStack.Push(Ch); Ch=_Ch;}

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlLx::PutEntityVal ( const TStr Nm,
const TStr Val 
) [inline]

Definition at line 177 of file xml.h.

References THash< TKey, TDat, THashFunc >::AddDat(), and EntityNmToValH.

Referenced by GetEntity().

                                                    {
    EntityNmToValH.AddDat(Nm, Val);}

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlLx::PutPEntityVal ( const TStr Nm,
const TStr Val 
) [inline]

Definition at line 181 of file xml.h.

References THash< TKey, TDat, THashFunc >::AddDat(), and PEntityNmToValH.

Referenced by GetEntity().

                                                     {
    PEntityNmToValH.AddDat(Nm, Val);}

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlLx::PutStr ( const TStr Str) [inline, private]

Definition at line 109 of file xml.h.

References ChN, TStr::Len(), and PutCh().

                              {
    for (int ChN=Str.Len()-1; ChN>=0; ChN--){PutCh(Str[ChN]);}}

Here is the call graph for this function:

void TXmlLx::SkipWs ( )

Definition at line 752 of file xml.cpp.

References Ch, ChDef, GetCh(), and TXmlChDef::IsWs().

Referenced by GetSym(), and TXmlDoc::LoadTxt().

                   {
  // [3] S ::=  (#x20 | #x9 | #xD | #xA)+
  while (ChDef.IsWs(Ch)){GetCh();}
}

Here is the call graph for this function:

Here is the caller graph for this function:

void TXmlLx::ToNrSpacing ( ) [private]

Definition at line 270 of file xml.cpp.

References ChDef, TCh::CrCh, Fail, TXmlChDef::IsWs(), TChA::LastCh(), TChA::Len(), TCh::LfCh, TChA::Pop(), TChA::PutCh(), Spacing, TChA::Trunc(), TxtChA, xspIntact, xspPreserve, xspSeparate, and xspTruncate.

Referenced by GetSym().

                        {
  if (Spacing==xspIntact){
  } else
  if (Spacing==xspPreserve){
    int SrcChN=0; int DstChN=0;
    while (SrcChN<TxtChA.Len()){
      if (TxtChA[SrcChN]==TCh::CrCh){
        TxtChA.PutCh(DstChN, TCh::LfCh); SrcChN++; DstChN++;
        if ((SrcChN<TxtChA.Len())&&(TxtChA[SrcChN]==TCh::LfCh)){SrcChN++;}
      } else {
        if (SrcChN!=DstChN){
          TxtChA.PutCh(DstChN, TxtChA[SrcChN]);}
        SrcChN++; DstChN++;
      }
    }
    TxtChA.Trunc(DstChN);
  } else
  if (Spacing==xspSeparate){
    // squeeze series of white-spaces to single space
    int SrcChN=0; int DstChN=0;
    while (SrcChN<TxtChA.Len()){
      if (ChDef.IsWs(TxtChA[SrcChN])){
        if ((DstChN>0)&&(TxtChA[DstChN-1]==' ')){
          SrcChN++;
        } else {
          TxtChA.PutCh(DstChN, ' ');
          SrcChN++; DstChN++;
        }
      } else {
        TxtChA.PutCh(DstChN, TxtChA[SrcChN]);
        SrcChN++; DstChN++;
      }
    }
    TxtChA.Trunc(DstChN);
  } else
  if (Spacing==xspTruncate){
    // cut leading and trailing white-spaces and
    // squeeze series of white-spaces to single space
    int SrcChN=0; int DstChN=0;
    while (SrcChN<TxtChA.Len()){
      if (ChDef.IsWs(TxtChA[SrcChN])){
        if ((DstChN>0)&&(TxtChA[DstChN-1]==' ')){
          SrcChN++;
        } else {
          TxtChA.PutCh(DstChN, ' ');
          SrcChN++; DstChN++;
        }
      } else {
        TxtChA.PutCh(DstChN, TxtChA[SrcChN]);
        SrcChN++; DstChN++;
      }
    }
    TxtChA.Trunc(DstChN);
    // delete trailing white-spaces
    while ((TxtChA.Len()>0)&&(ChDef.IsWs(TxtChA.LastCh()))){
      TxtChA.Pop();}
  } else {
    Fail;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

int TXmlLx::ChN [private]
TChA TXmlLx::ChStack [private]

Definition at line 103 of file xml.h.

Referenced by GetCh(), and PutCh().

Definition at line 113 of file xml.h.

Referenced by IsEntityNm(), and PutEntityVal().

int TXmlLx::LnChN [private]

Definition at line 105 of file xml.h.

Referenced by EThrow(), GetCh(), and GetFPosStr().

int TXmlLx::LnN [private]

Definition at line 105 of file xml.h.

Referenced by EThrow(), GetCh(), and GetFPosStr().

Definition at line 113 of file xml.h.

Referenced by IsPEntityNm(), and PutPEntityVal().

uchar TXmlLx::PrevCh [private]

Definition at line 104 of file xml.h.

Referenced by GetCh().

TSIn& TXmlLx::RSIn [private]

Definition at line 102 of file xml.h.

Referenced by GetCh().

PSIn TXmlLx::SIn [private]

Definition at line 101 of file xml.h.

Referenced by EThrow(), and GetFPosStr().

Definition at line 106 of file xml.h.

Referenced by GetSym(), and ToNrSpacing().


The documentation for this class was generated from the following files: