SNAP Library, Developer Reference  2012-10-15 15:06:59
SNAP, a general purpose network analysis and graph mining library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
xml.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  TXmlObjSer
class  TXmlObjSerTagNm
class  TXmlLx
class  TXmlParser

Typedefs

typedef TPt< TXmlParserPXmlParser

Enumerations

enum  TXmlLxSym {
  xsyUndef, xsyWs, xsyComment, xsyXmlDecl,
  xsyPI, xsyDocTypeDecl, xsyElement, xsyAttList,
  xsyEntity, xsyNotation, xsyTag, xsySTag,
  xsyETag, xsySETag, xsyStr, xsyQStr,
  xsyEof
}
enum  TXmlSpacing { xspIntact, xspPreserve, xspSeparate, xspTruncate }

Functions

void SetChTy (TBSet &ChSet, const int &MnCh, const int &MxCh=-1)
void SetChTy (TBSet &ChSet, const TStr &Str)
void SetEntityVal (const TStr &Nm, const TStr &Val)
 TXmlChDef ()
 TXmlChDef (TSIn &SIn)
static PXmlChDef Load (TSIn &SIn)
void Save (TSOut &SOut)
TXmlChDefoperator= (const TXmlChDef &)
bool IsChar (const uchar &Ch) const
bool IsComb (const uchar &Ch) const
bool IsExt (const uchar &Ch) const
bool IsLetter (const uchar &Ch) const
bool IsDigit (const uchar &Ch) const
bool IsName (const uchar &Ch) const
bool IsPubid (const uchar &Ch) const
bool IsWs (const uchar &Ch) const
bool IsFirstNameCh (const uchar &Ch) const
bool IsEoln (const uchar &Ch) const
bool IsEntityNm (const TStr &EntityNm, TStr &EntityVal) const
 TXmlTok ()
 TXmlTok (const TXmlLxSym &_Sym)
 TXmlTok (const TXmlLxSym &_Sym, const TStr &_Str)
 TXmlTok (const TXmlLxSym &_Sym, const TStr &_Str, const TStrKdV &_ArgNmValV)
static PXmlTok New ()
static PXmlTok New (const TXmlLxSym &Sym)
static PXmlTok New (const TXmlLxSym &Sym, const TStr &Str)
static PXmlTok New (const TXmlLxSym &Sym, const TStr &Str, const TStrKdV &ArgNmValV)
static PXmlTok New (const TStr &TagNm, const TStrKdV &ArgNmValV)
static PXmlTok New (const TStr &TagNm)
static PXmlTok New (const TStr &TagNm, const TStr &ValStr)
static PXmlTok New (const TStr &TagNm, const PXmlTok &XmlTok1, const PXmlTok &XmlTok2=NULL)
 TXmlTok (TSIn &)
TXmlTokoperator= (const TXmlTok &)
TXmlLxSym GetSym () const
TStr GetSymStr () const
void PutStr (const TStr &_Str)
TStr GetStr () const
bool IsTag () const
bool IsTag (const TStr &TagNm) const
TStr GetTagNm () const
void AddArg (const TStr &ArgNm, const bool &ArgVal)
void AddArg (const TStr &ArgNm, const int &ArgVal)
void AddArg (const TStr &ArgNm, const uint64 &ArgVal)
void AddArg (const TStr &ArgNm, const double &ArgVal)
void AddArg (const TStr &ArgNm, const TStr &ArgVal)
int GetArgs () const
void GetArg (const int &ArgN, TStr &ArgNm, TStr &ArgVal) const
bool IsArg (const TStr &ArgNm) const
bool IsArg (const TStr &ArgNm, TStr &ArgVal) const
void PutArgVal (const TStr &ArgNm, const TStr &ArgVal)
TStr GetArgVal (const TStr &ArgNm) const
TStr GetArgVal (const TStr &ArgNm, const TStr &DfArgVal) const
bool GetBoolArgVal (const TStr &ArgNm, const bool &DfVal=false) const
bool GetBoolArgVal (const TStr &ArgNm, const TStr &TrueVal, const bool &DfVal=false) const
bool GetBoolArgVal (const TStr &ArgNm, const TStr &TrueVal, const TStr &FalseVal, const bool &DfVal=false) const
int GetIntArgVal (const TStr &ArgNm, const int &DfVal=0) const
double GetFltArgVal (const TStr &ArgNm, const double &DfVal=0) const
TStr GetStrArgVal (const TStr &ArgNm, const TStr &DfVal=TStr()) const
bool IsSubTag (const TStr &TagNm) const
bool IsSubTag (const TStr &TagNm, PXmlTok &Tok) const
void AddSubTok (const PXmlTok &Tok)
int GetSubToks () const
PXmlTok GetSubTok (const int &SubTokN) const
void ClrSubTok ()
void PutSubTok (const PXmlTok &Tok, const int &SubTokN=-1)
bool IsTagTok (const TStr &TagPath, PXmlTok &TagTok) const
bool IsTagTok (const TStr &TagPath) const
PXmlTok GetTagTok (const TStr &TagPath) const
void GetTagTokV (const TStr &TagPath, TXmlTokV &XmlTokV) const
void GetTagValV (const TStr &TagNm, const bool &XmlP, TStrV &ValV) const
TStr GetTagVal (const TStr &TagNm, const bool &XmlP) const
TStr GetTagTokStr (const TStr &TagPath) const
TStr GetTagTokStrOrDf (const TStr &TagPath, const TStr &DfVal=TStr()) const
void AddTokToChA (const bool &XmlP, TChA &ChA) const
TStr GetTokStr (const bool &XmlP=true) const
static TStr GetTokVStr (const TXmlTokV &TokV, const bool &XmlP=true)
static PXmlTok GetTok (TXmlLx &Lx)
static void LoadTxtMiscStar (TXmlLx &Lx)
static PXmlTok LoadTxtElement (TXmlLx &Lx)
 TXmlDoc ()
 TXmlDoc (const PXmlTok &_Tok)
static PXmlDoc New (const PXmlTok &Tok)
 TXmlDoc (TSIn &)
TXmlDocoperator= (const TXmlDoc &)
bool IsOk () const
TStr GetMsgStr () const
PXmlTok GetTok () const
void PutTagTokStr (const TStr &TagPath, const TStr &TokStr) const
bool GetTagTokBoolArgVal (const TStr &TagPath, const TStr &ArgNm, const bool &DfVal=false) const
int GetTagTokIntArgVal (const TStr &TagPath, const TStr &ArgNm, const int &DfVal=0) const
double GetTagTokFltArgVal (const TStr &TagPath, const TStr &ArgNm, const double &DfVal=0) const
TStr GetTagTokStrArgVal (const TStr &TagPath, const TStr &ArgNm, const TStr &DfVal=TStr()) const
static TStr GetXmlStr (const TStr &Str)
static bool SkipTopTag (const PSIn &SIn)
static PXmlDoc LoadTxt (TXmlLx &Lx)
static PXmlDoc LoadTxt (const PSIn &SIn, const TXmlSpacing &Spacing=xspIntact)
static PXmlDoc LoadTxt (const TStr &FNm, const TXmlSpacing &Spacing=xspIntact)
static void LoadTxt (const TStr &FNm, TXmlDocV &XmlDocV, const TXmlSpacing &Spacing=xspIntact)
void SaveTxt (const PSOut &SOut)
void SaveTxt (const TStr &FNm, const bool &Append=false)
static PXmlDoc LoadStr (const TStr &Str)
void SaveStr (TStr &Str)

Variables

ClassTP(TXmlChDef, PXmlChDef)
private TBSet 
CharChSet
ClassTP(TXmlChDef, PXmlChDef)
private TBSet 
CombChSet
ClassTP(TXmlChDef, PXmlChDef)
private TBSet 
ExtChSet
TBSet LetterChSet
TBSet DigitChSet
TBSet NameChSet
TBSet PubidChSet
TStrStrH EntityNmToValH
ClassTPV(TXmlTok, PXmlTok,
TXmlTokV) private TStr 
Str
TStrKdV ArgNmValV
TXmlTokV SubTokV
ClassTPV(TXmlDoc, PXmlDoc,
TXmlDocV) private TStr 
MsgStr
PXmlTok Tok

Typedef Documentation

Definition at line 392 of file xml.h.


Enumeration Type Documentation

enum TXmlLxSym
Enumerator:
xsyUndef 
xsyWs 
xsyComment 
xsyXmlDecl 
xsyPI 
xsyDocTypeDecl 
xsyElement 
xsyAttList 
xsyEntity 
xsyNotation 
xsyTag 
xsySTag 
xsyETag 
xsySETag 
xsyStr 
xsyQStr 
xsyEof 

Definition at line 87 of file xml.h.

Enumerator:
xspIntact 
xspPreserve 
xspSeparate 
xspTruncate 

Definition at line 94 of file xml.h.


Function Documentation

void AddArg ( const TStr ArgNm,
const bool &  ArgVal 
)

Definition at line 250 of file xml.h.

References TVec< TVal >::Add(), ArgNmValV, and TBool::GetStr().

                                                    {
    ArgNmValV.Add(TStrKd(ArgNm, TBool::GetStr(ArgVal)));}

Here is the call graph for this function:

void AddArg ( const TStr ArgNm,
const int &  ArgVal 
)

Definition at line 252 of file xml.h.

References TVec< TVal >::Add(), ArgNmValV, and TInt::GetStr().

                                                   {
    ArgNmValV.Add(TStrKd(ArgNm, TInt::GetStr(ArgVal)));}

Here is the call graph for this function:

void AddArg ( const TStr ArgNm,
const uint64 ArgVal 
)

Definition at line 254 of file xml.h.

References TVec< TVal >::Add(), ArgNmValV, and TUInt64::GetStr().

                                                      {
    ArgNmValV.Add(TStrKd(ArgNm, TUInt64::GetStr(ArgVal)));}

Here is the call graph for this function:

void AddArg ( const TStr ArgNm,
const double &  ArgVal 
)

Definition at line 256 of file xml.h.

References TVec< TVal >::Add(), ArgNmValV, and TFlt::GetStr().

                                                      {
    ArgNmValV.Add(TStrKd(ArgNm, TFlt::GetStr(ArgVal)));}

Here is the call graph for this function:

void AddArg ( const TStr ArgNm,
const TStr ArgVal 
)

Definition at line 258 of file xml.h.

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

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

Here is the call graph for this function:

void AddSubTok ( const PXmlTok Tok)

Definition at line 290 of file xml.h.

References SubTokV.

Referenced by PutSubTok().

{SubTokV.Add(Tok);}

Here is the caller graph for this function:

void TXmlTok::AddTokToChA ( const bool &  XmlP,
TChA ChA 
) const

Definition at line 1179 of file xml.cpp.

References Fail, GetArg(), GetArgs(), TXmlLx::GetArgValQCh(), GetSubTok(), GetSubToks(), TXmlLx::GetXmlStrFromPlainStr(), Str, xsyQStr, xsyStr, xsyTag, and xsyWs.

Referenced by GetTokStr().

                                                           {
  switch (Sym){
    case xsyWs:
      ChA+=Str; break;
    case xsyStr:
      if (XmlP){ChA+=TXmlLx::GetXmlStrFromPlainStr(Str);} else {ChA+=Str;} break;
    case xsyQStr:
      if (XmlP){ChA+="<![CDATA[";}
      ChA+=Str;
      if (XmlP){ChA+="]]>";} break;
    case xsyTag:
      if (XmlP){
        ChA+='<'; ChA+=Str;
        for (int ArgN=0; ArgN<GetArgs(); ArgN++){
          TStr ArgNm; TStr ArgVal; GetArg(ArgN, ArgNm, ArgVal);
          if (XmlP){ArgVal=TXmlLx::GetXmlStrFromPlainStr(ArgVal);}
          char ArgValQCh=TXmlLx::GetArgValQCh(ArgVal);
          ChA+=' '; ChA+=ArgNm; ChA+='=';
          ChA+=ArgValQCh; ChA+=ArgVal; ChA+=ArgValQCh;
        }
      }
      if (GetSubToks()==0){
        if (XmlP){ChA+="/>";}
      } else {
        if (XmlP){ChA+=">";}
        for (int SubTokN=0; SubTokN<GetSubToks(); SubTokN++){
          GetSubTok(SubTokN)->AddTokToChA(XmlP, ChA);}
        if (XmlP){ChA+="</"; ChA+=Str; ChA+='>';}
      }
      break;
    default: Fail;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ClrSubTok ( )

Definition at line 293 of file xml.h.

References SubTokV.

Referenced by PutSubTok().

{SubTokV.Clr();}

Here is the caller graph for this function:

void GetArg ( const int &  ArgN,
TStr ArgNm,
TStr ArgVal 
) const

Definition at line 261 of file xml.h.

References ArgNmValV.

                                                                {
    ArgNm=ArgNmValV[ArgN].Key; ArgVal=ArgNmValV[ArgN].Dat;}
int GetArgs ( ) const

Definition at line 260 of file xml.h.

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

Referenced by AddTokToChA().

{return ArgNmValV.Len();}

Here is the call graph for this function:

Here is the caller graph for this function:

TStr GetArgVal ( const TStr ArgNm) const

Definition at line 271 of file xml.h.

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

                                          {
    return ArgNmValV[ArgNmValV.SearchForw(TStrKd(ArgNm))].Dat;}

Here is the call graph for this function:

TStr GetArgVal ( const TStr ArgNm,
const TStr DfArgVal 
) const

Definition at line 273 of file xml.h.

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

                                                                {
    int ArgN=ArgNmValV.SearchForw(TStrKd(ArgNm));
    return (ArgN==-1) ? DfArgVal : ArgNmValV[ArgN].Dat;}

Here is the call graph for this function:

bool TXmlTok::GetBoolArgVal ( const TStr ArgNm,
const bool &  DfVal = false 
) const

Definition at line 1083 of file xml.cpp.

References ArgNmValV, TVec< TVal >::SearchForw(), and TBool::TrueStr.

                                                                      {
  int ArgN=ArgNmValV.SearchForw(TStrKd(ArgNm));
  return (ArgN==-1) ? DfVal : (ArgNmValV[ArgN].Dat==TBool::TrueStr);
}

Here is the call graph for this function:

bool TXmlTok::GetBoolArgVal ( const TStr ArgNm,
const TStr TrueVal,
const bool &  DfVal = false 
) const

Definition at line 1088 of file xml.cpp.

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

                                                                  {
  int ArgN=ArgNmValV.SearchForw(TStrKd(ArgNm));
  return (ArgN==-1) ? DfVal : (ArgNmValV[ArgN].Dat==TrueVal);
}

Here is the call graph for this function:

bool TXmlTok::GetBoolArgVal ( const TStr ArgNm,
const TStr TrueVal,
const TStr FalseVal,
const bool &  DfVal = false 
) const

Definition at line 1094 of file xml.cpp.

References ArgNmValV, IAssert, and TVec< TVal >::SearchForw().

                                                                     {
  int ArgN=ArgNmValV.SearchForw(TStrKd(ArgNm));
  if (ArgN==-1){return DfVal;}
  TStr ArgVal=ArgNmValV[ArgN].Dat;
  if (ArgVal==TrueVal){return true;}
  IAssert(ArgVal == FalseVal); return false;
}

Here is the call graph for this function:

double TXmlTok::GetFltArgVal ( const TStr ArgNm,
const double &  DfVal = 0 
) const

Definition at line 1113 of file xml.cpp.

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

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

Here is the call graph for this function:

int TXmlTok::GetIntArgVal ( const TStr ArgNm,
const int &  DfVal = 0 
) const

Definition at line 1103 of file xml.cpp.

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

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

Here is the call graph for this function:

TStr GetMsgStr ( ) const

Definition at line 344 of file xml.h.

References MsgStr.

{return MsgStr;}
TStr TXmlTok::GetStrArgVal ( const TStr ArgNm,
const TStr DfVal = TStr() 
) const

Definition at line 1123 of file xml.cpp.

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

                                                                     {
  int ArgN=ArgNmValV.SearchForw(TStrKd(ArgNm));
  return (ArgN==-1) ? DfVal : ArgNmValV[ArgN].Dat;
}

Here is the call graph for this function:

PXmlTok GetSubTok ( const int &  SubTokN) const

Definition at line 292 of file xml.h.

References SubTokV.

Referenced by AddTokToChA(), and GetTagValV().

{return SubTokV[SubTokN];}

Here is the caller graph for this function:

int GetSubToks ( ) const

Definition at line 291 of file xml.h.

References SubTokV.

Referenced by AddTokToChA(), and GetTagValV().

{return SubTokV.Len();}

Here is the caller graph for this function:

TXmlLxSym GetSym ( ) const

Definition at line 239 of file xml.h.

{return Sym;}
TStr GetSymStr ( ) const

Definition at line 240 of file xml.h.

References TXmlLx::GetXmlLxSymStr().

Referenced by TOLx::PutSym().

{return TXmlLx::GetXmlLxSymStr(Sym);}

Here is the call graph for this function:

Here is the caller graph for this function:

TStr GetTagNm ( ) const

Definition at line 247 of file xml.h.

References IAssert, Str, and xsyTag.

{IAssert(Sym==xsyTag); return Str;}
PXmlTok GetTagTok ( const TStr TagPath) const

Definition at line 1136 of file xml.cpp.

References TStr::Empty(), TPt< TRec >::Empty(), TStr::SplitOnCh(), SubTokV, TXmlTok(), and xsyTag.

Referenced by GetTagTokStr(), GetTagTokV(), IsSubTag(), IsTagTok(), and PutTagTokStr().

                                                    {
  if (TagPath.Empty()){
    return (TXmlTok*)this;
  } else {
    TStr TagNm; TStr RestTagPath; TagPath.SplitOnCh(TagNm, '|', RestTagPath);
    PXmlTok SubTok;
    for (int SubTokN=0; SubTokN<SubTokV.Len(); SubTokN++){
      SubTok=SubTokV[SubTokN];
      if ((SubTok->GetSym()==xsyTag)&&(SubTok->GetStr()==TagNm)){break;}
      else {SubTok=NULL;}
    }
    if ((SubTok.Empty())||(RestTagPath.Empty())){return SubTok;}
    else {return SubTok->GetTagTok(RestTagPath);}
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TXmlDoc::GetTagTokBoolArgVal ( const TStr TagPath,
const TStr ArgNm,
const bool &  DfVal = false 
) const

Definition at line 1326 of file xml.cpp.

References IsTagTok().

                                                                  {
  PXmlTok TagTok;
  if (IsTagTok(TagPath, TagTok)){
    return TagTok->GetBoolArgVal(ArgNm, DfVal);}
  else {return DfVal;}
}

Here is the call graph for this function:

double TXmlDoc::GetTagTokFltArgVal ( const TStr TagPath,
const TStr ArgNm,
const double &  DfVal = 0 
) const

Definition at line 1342 of file xml.cpp.

References IsTagTok().

                                                                    {
  PXmlTok TagTok;
  if (IsTagTok(TagPath, TagTok)){
    return TagTok->GetFltArgVal(ArgNm, DfVal);}
  else {return DfVal;}
}

Here is the call graph for this function:

int TXmlDoc::GetTagTokIntArgVal ( const TStr TagPath,
const TStr ArgNm,
const int &  DfVal = 0 
) const

Definition at line 1334 of file xml.cpp.

References IsTagTok().

                                                                 {
  PXmlTok TagTok;
  if (IsTagTok(TagPath, TagTok)){
    return TagTok->GetIntArgVal(ArgNm, DfVal);}
  else {return DfVal;}
}

Here is the call graph for this function:

TStr GetTagTokStr ( const TStr TagPath) const

Definition at line 305 of file xml.h.

References GetTagTok().

                                               {
    return GetTagTok(TagPath)->GetTokStr(false);}

Here is the call graph for this function:

TStr TXmlDoc::GetTagTokStrArgVal ( const TStr TagPath,
const TStr ArgNm,
const TStr DfVal = TStr() 
) const

Definition at line 1350 of file xml.cpp.

References IsTagTok().

                                                                  {
  PXmlTok TagTok;
  if (IsTagTok(TagPath, TagTok)){
    return TagTok->GetStrArgVal(ArgNm, DfVal);}
  else {return DfVal;}
}

Here is the call graph for this function:

TStr GetTagTokStrOrDf ( const TStr TagPath,
const TStr DfVal = TStr() 
) const

Definition at line 307 of file xml.h.

References IsTagTok().

                                                                             {
    PXmlTok TagTok;
    if (IsTagTok(TagPath, TagTok)){return TagTok->GetTokStr(false);}
    else {return DfVal;}}

Here is the call graph for this function:

void GetTagTokV ( const TStr TagPath,
TXmlTokV &  XmlTokV 
) const

Definition at line 1152 of file xml.cpp.

References TPt< TRec >::Empty(), GetTagTok(), TStr::SplitOnLastCh(), Tok, and xsyTag.

                                                                     {
  XmlTokV.Clr();
  TStr PreTagPath; TStr TagNm; TagPath.SplitOnLastCh(PreTagPath, '|', TagNm);
  PXmlTok Tok=GetTagTok(PreTagPath);
  if (!Tok.Empty()){
    for (int SubTokN=0; SubTokN<Tok->GetSubToks(); SubTokN++){
      PXmlTok SubTok=Tok->GetSubTok(SubTokN);
      if ((SubTok->GetSym()==xsyTag)&&(SubTok->GetStr()==TagNm)){
        XmlTokV.Add(SubTok);}
    }
  }
}

Here is the call graph for this function:

TStr GetTagVal ( const TStr TagNm,
const bool &  XmlP 
) const

Definition at line 359 of file xml.h.

References GetTagValV(), TVec< TVal >::Len(), and ValV.

                                                            {
    TStrV ValV; GetTagValV(TagNm, XmlP, ValV);
    if (ValV.Len()>0){return ValV[0];} else {return "";}}

Here is the call graph for this function:

void GetTagValV ( const TStr TagNm,
const bool &  XmlP,
TStrV ValV 
) const

Definition at line 1165 of file xml.cpp.

References TVec< TVal >::Add(), GetSubTok(), GetSubToks(), GetTokStr(), and xsyTag.

Referenced by GetTagVal().

                                                                               {
  if ((Sym==xsyTag)&&(Str==TagNm)){
    ValV.Add(GetTokStr(XmlP));
  } else {
    for (int SubTokN=0; SubTokN<GetSubToks(); SubTokN++){
      GetSubTok(SubTokN)->GetTagValV(TagNm, XmlP, ValV);}
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PXmlTok GetTok ( TXmlLx Lx) [static]
PXmlTok GetTok ( ) const

Definition at line 345 of file xml.h.

References IAssert, and Tok.

{IAssert(Ok); return Tok;}
TStr GetTokStr ( const bool &  XmlP = true) const

Definition at line 314 of file xml.h.

References AddTokToChA().

Referenced by GetTagValV(), and SaveTxt().

                                              {
    TChA ChA; AddTokToChA(XmlP, ChA); return ChA;}

Here is the call graph for this function:

Here is the caller graph for this function:

TStr TXmlTok::GetTokVStr ( const TXmlTokV &  TokV,
const bool &  XmlP = true 
) [static]

Definition at line 1213 of file xml.cpp.

                                                              {
  TChA TokVChA;
  for (int TokN=0; TokN<TokV.Len(); TokN++){
    if (TokN>0){TokVChA+=' ';}
    TokVChA+=TokV[TokN]->GetTokStr(XmlP);
  }
  return TokVChA;
}
TStr TXmlDoc::GetXmlStr ( const TStr Str) [static]

Definition at line 1358 of file xml.cpp.

References TUInt::GetStr(), TChA::Len(), and Str.

                                      {
  TChA ChA=Str;
  TChA XmlChA;
  for (int ChN=0; ChN<ChA.Len(); ChN++){
    uchar Ch=ChA[ChN];
    if ((' '<=Ch)&&(Ch<='~')){
      if (Ch=='&'){XmlChA+="&amp;";}
      else if (Ch=='>'){XmlChA+="&lt;";}
      else if (Ch=='<'){XmlChA+="&gt;";}
      else if (Ch=='\''){XmlChA+="&apos;";}
      else if (Ch=='\"'){XmlChA+="&quot;";}
      else {XmlChA+=Ch;}
    } else {
      XmlChA+="&#"; XmlChA+=TUInt::GetStr(Ch); XmlChA+=";";
    }
  }
  return XmlChA;
}

Here is the call graph for this function:

bool IsArg ( const TStr ArgNm) const

Definition at line 263 of file xml.h.

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

                                      {
    return ArgNmValV.SearchForw(TStrKd(ArgNm))!=-1;}

Here is the call graph for this function:

bool IsArg ( const TStr ArgNm,
TStr ArgVal 
) const

Definition at line 265 of file xml.h.

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

                                                    {
    int ArgN=ArgNmValV.SearchForw(TStrKd(ArgNm));
    if (ArgN!=-1){ArgVal=ArgNmValV[ArgN].Dat;}
    return ArgN!=-1;}

Here is the call graph for this function:

bool IsChar ( const uchar Ch) const

Definition at line 66 of file xml.h.

References CharChSet.

{return CharChSet.GetBit(Ch);}
bool IsComb ( const uchar Ch) const

Definition at line 67 of file xml.h.

References CombChSet.

{return CombChSet.GetBit(Ch);}
bool IsDigit ( const uchar Ch) const

Definition at line 70 of file xml.h.

References DigitChSet.

{return DigitChSet.GetBit(Ch);}
bool IsEntityNm ( const TStr EntityNm,
TStr EntityVal 
) const

Definition at line 81 of file xml.h.

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

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

Here is the call graph for this function:

bool IsEoln ( const uchar Ch) const

Definition at line 78 of file xml.h.

References TCh::CrCh, and TCh::LfCh.

                                     {
    return (Ch==TCh::CrCh)||(Ch==TCh::LfCh);}
bool IsExt ( const uchar Ch) const

Definition at line 68 of file xml.h.

References ExtChSet.

{return ExtChSet.GetBit(Ch);}
bool IsFirstNameCh ( const uchar Ch) const

Definition at line 76 of file xml.h.

References IsLetter().

Referenced by TXmlLx::IsTagNm().

                                            {
    return IsLetter(Ch)||(Ch=='_')||(Ch==':');}

Here is the call graph for this function:

Here is the caller graph for this function:

bool IsLetter ( const uchar Ch) const

Definition at line 69 of file xml.h.

References LetterChSet.

Referenced by IsFirstNameCh().

{return LetterChSet.GetBit(Ch);}

Here is the caller graph for this function:

bool IsName ( const uchar Ch) const

Definition at line 71 of file xml.h.

References NameChSet.

Referenced by TXmlLx::IsTagNm().

{return NameChSet.GetBit(Ch);}

Here is the caller graph for this function:

bool IsOk ( ) const

Definition at line 343 of file xml.h.

{return Ok;}
bool IsPubid ( const uchar Ch) const

Definition at line 72 of file xml.h.

References PubidChSet.

{return PubidChSet.GetBit(Ch);}
bool IsSubTag ( const TStr TagNm) const

Definition at line 286 of file xml.h.

References TPt< TRec >::Empty(), and GetTagTok().

                                         {
    return !GetTagTok(TagNm).Empty();}

Here is the call graph for this function:

bool IsSubTag ( const TStr TagNm,
PXmlTok Tok 
) const

Definition at line 288 of file xml.h.

References TPt< TRec >::Empty(), and GetTagTok().

                                                       {
    Tok=GetTagTok(TagNm); return !Tok.Empty();}

Here is the call graph for this function:

bool IsTag ( ) const

Definition at line 245 of file xml.h.

References xsyTag.

{return (Sym==xsyTag);}
bool IsTag ( const TStr TagNm) const

Definition at line 246 of file xml.h.

References Str, and xsyTag.

{return (Sym==xsyTag)&&(Str==TagNm);}
bool IsTagTok ( const TStr TagPath,
PXmlTok TagTok 
) const

Definition at line 297 of file xml.h.

References TPt< TRec >::Empty(), and GetTagTok().

Referenced by GetTagTokBoolArgVal(), GetTagTokFltArgVal(), GetTagTokIntArgVal(), GetTagTokStrArgVal(), GetTagTokStrOrDf(), and IsTagTok().

                                                            {
    TagTok=GetTagTok(TagPath); return !TagTok.Empty();}

Here is the call graph for this function:

Here is the caller graph for this function:

bool IsTagTok ( const TStr TagPath) const

Definition at line 299 of file xml.h.

References IsTagTok().

                                           {
    PXmlTok TagTok; return IsTagTok(TagPath, TagTok);}

Here is the call graph for this function:

bool IsWs ( const uchar Ch) const

Definition at line 74 of file xml.h.

References TCh::CrCh, TCh::LfCh, and TCh::TabCh.

                                   {
    return (Ch==' ')||(Ch==TCh::CrCh)||(Ch==TCh::LfCh)||(Ch==TCh::TabCh);}
static PXmlDoc Load ( TSIn SIn) [static]

Definition at line 56 of file xml.h.

References TXmlChDef().

{return new TXmlChDef(SIn);}

Here is the call graph for this function:

PXmlDoc TXmlDoc::LoadStr ( const TStr Str) [static]

Definition at line 1437 of file xml.cpp.

References LoadTxt(), and TStrIn::New().

                                       {
  PSIn SIn=TStrIn::New(Str);
  return LoadTxt(SIn);
}

Here is the call graph for this function:

static PXmlDoc LoadTxt ( TXmlLx Lx) [static]
static PXmlDoc LoadTxt ( const PSIn SIn,
const TXmlSpacing Spacing = xspIntact 
) [static]
static PXmlDoc LoadTxt ( const TStr FNm,
const TXmlSpacing Spacing = xspIntact 
) [static]
static void LoadTxt ( const TStr FNm,
TXmlDocV &  XmlDocV,
const TXmlSpacing Spacing = xspIntact 
) [static]

Definition at line 1243 of file xml.cpp.

References TPt< TRec >::Empty(), TXmlLx::EThrow(), forever, TStr::GetStr(), TXmlLx::GetSym(), GetTok(), MsgStr, TXmlLx::Sym, TXmlLx::TagNm, Tok, xsyComment, xsyETag, xsyPI, xsyQStr, xsySETag, xsySTag, xsyStr, and xsyWs.

                                         {
  // [39]  element ::=  EmptyElemTag | STag content ETag
  PXmlTok Tok;
  if (Lx.Sym==xsySETag){
    Tok=TXmlTok::GetTok(Lx);
  } else
  if (Lx.Sym==xsySTag){
    Tok=TXmlTok::GetTok(Lx);
    forever {
      Lx.GetSym();
      if (Lx.Sym==xsyETag){
        if (Tok->GetStr()==Lx.TagNm){
          break;
        } else {
          TStr MsgStr=TStr("Invalid End-Tag '")+Lx.TagNm+
           "' ('"+Tok->GetStr()+"' expected).";
          Lx.EThrow(MsgStr);
        }
      } else {
        PXmlTok SubTok;
        switch (Lx.Sym){
          case xsySTag:
            SubTok=LoadTxtElement(Lx); break;
          case xsySETag:
          case xsyStr:
          case xsyQStr:
          case xsyWs:
            SubTok=TXmlTok::GetTok(Lx); break;
          case xsyPI:
          case xsyComment:
            break;
          default: Lx.EThrow("Content or End-Tag expected.");
        }
        if (!SubTok.Empty()){
          Tok->AddSubTok(SubTok);}
      }
    }
  } else
  if (Lx.Sym==xsyETag){
    TStr MsgStr=
     TStr("Xml-Element (Start-Tag or Empty-Element-Tag) required.")+
     TStr::GetStr(Lx.TagNm, " End-Tag </%s> encountered.");
    Lx.EThrow(MsgStr);
  } else {
    Lx.EThrow("Xml-Element (Start-Tag or Empty-Element-Tag) required.");
  }
  return Tok;
}

Here is the call graph for this function:

void TXmlDoc::LoadTxtMiscStar ( TXmlLx Lx) [static]

Definition at line 1237 of file xml.cpp.

References TXmlLx::GetSym(), TXmlLx::Sym, xsyComment, xsyPI, and xsyWs.

Referenced by SkipTopTag().

                                       {
  // [27] Misc ::=  Comment | PI |  S
  while ((Lx.Sym==xsyComment)||(Lx.Sym==xsyPI)||(Lx.Sym==xsyWs)){
    Lx.GetSym();}
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PXmlDoc New ( ) [static]

Definition at line 210 of file xml.h.

References TXmlTok().

{return PXmlTok(new TXmlTok());}

Here is the call graph for this function:

static PXmlTok New ( const TXmlLxSym Sym) [static]

Definition at line 211 of file xml.h.

References TXmlTok().

{return PXmlTok(new TXmlTok(Sym));}

Here is the call graph for this function:

static PXmlTok New ( const TXmlLxSym Sym,
const TStr Str 
) [static]

Definition at line 212 of file xml.h.

References TXmlTok().

                                                           {
    return PXmlTok(new TXmlTok(Sym, Str));}

Here is the call graph for this function:

static PXmlTok New ( const TXmlLxSym Sym,
const TStr Str,
const TStrKdV ArgNmValV 
) [static]

Definition at line 214 of file xml.h.

References TXmlTok().

                                                                   {
    return PXmlTok(new TXmlTok(Sym, Str, ArgNmValV));}

Here is the call graph for this function:

static PXmlTok New ( const TStr TagNm,
const TStrKdV ArgNmValV 
) [static]

Definition at line 217 of file xml.h.

References TXmlTok(), and xsyTag.

                                               {
    return PXmlTok(new TXmlTok(xsyTag, TagNm, ArgNmValV));}

Here is the call graph for this function:

static PXmlTok New ( const TStr TagNm) [static]

Definition at line 220 of file xml.h.

References TXmlTok(), and xsyTag.

                                       {
    return PXmlTok(new TXmlTok(xsyTag, TagNm));}

Here is the call graph for this function:

static PXmlTok New ( const TStr TagNm,
const TStr ValStr 
) [static]

Definition at line 222 of file xml.h.

References TXmlTok(), xsyStr, and xsyTag.

                                                           {
    PXmlTok TagXmlTok=PXmlTok(new TXmlTok(xsyTag, TagNm));
    PXmlTok StrXmlTok=PXmlTok(new TXmlTok(xsyStr, ValStr));
    TagXmlTok->AddSubTok(StrXmlTok); return TagXmlTok;}

Here is the call graph for this function:

static PXmlTok New ( const TStr TagNm,
const PXmlTok XmlTok1,
const PXmlTok XmlTok2 = NULL 
) [static]

Definition at line 226 of file xml.h.

References TPt< TRec >::Empty(), TXmlTok(), and xsyTag.

                                                       {
    PXmlTok TagXmlTok=PXmlTok(new TXmlTok(xsyTag, TagNm));
    if (!XmlTok1.Empty()){TagXmlTok->AddSubTok(XmlTok1);}
    if (!XmlTok2.Empty()){TagXmlTok->AddSubTok(XmlTok2);}
    return TagXmlTok;}

Here is the call graph for this function:

static PXmlDoc New ( const PXmlTok Tok) [static]

Definition at line 335 of file xml.h.

References TXmlDoc().

{return PXmlDoc(new TXmlDoc(Tok));}

Here is the call graph for this function:

TXmlChDef& operator= ( const TXmlChDef )

Definition at line 64 of file xml.h.

References Fail.

{Fail; return *this;}
TXmlTok& operator= ( const TXmlTok )

Definition at line 236 of file xml.h.

References Fail.

{Fail; return *this;}
TXmlDoc& operator= ( const TXmlDoc )

Definition at line 340 of file xml.h.

References Fail.

{Fail; return *this;}
void PutArgVal ( const TStr ArgNm,
const TStr ArgVal 
)

Definition at line 269 of file xml.h.

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

                                                       {
    ArgNmValV[ArgNmValV.SearchForw(TStrKd(ArgNm))].Dat=ArgVal;}

Here is the call graph for this function:

void PutStr ( const TStr _Str)

Definition at line 241 of file xml.h.

References Str.

{Str=_Str;}
void TXmlTok::PutSubTok ( const PXmlTok Tok,
const int &  SubTokN = -1 
)

Definition at line 1128 of file xml.cpp.

References AddSubTok(), ClrSubTok(), SubTokV, and Tok.

                                                             {
  if (SubTokN==-1){
    ClrSubTok(); AddSubTok(Tok);
  } else {
    SubTokV[SubTokN]=Tok;
  }
}

Here is the call graph for this function:

void TXmlDoc::PutTagTokStr ( const TStr TagPath,
const TStr TokStr 
) const

Definition at line 1306 of file xml.cpp.

References GetTagTok(), New(), Tok, and xsyStr.

                                                                        {
  PXmlTok Tok=GetTagTok(TagPath);
  Tok->ClrSubTok();
  PXmlTok StrTok=TXmlTok::New(xsyStr, TokStr);
  Tok->AddSubTok(StrTok);
}

Here is the call graph for this function:

void Save ( TSOut SOut)

Definition at line 57 of file xml.h.

References CharChSet, CombChSet, DigitChSet, EntityNmToValH, ExtChSet, LetterChSet, NameChSet, PubidChSet, and THash< TKey, TDat, THashFunc >::Save().

                        {
    Chs.Save(SOut);
    CharChSet.Save(SOut); CombChSet.Save(SOut); ExtChSet.Save(SOut);
    LetterChSet.Save(SOut); DigitChSet.Save(SOut); NameChSet.Save(SOut);
    PubidChSet.Save(SOut);
    EntityNmToValH.Save(SOut);}

Here is the call graph for this function:

void TXmlDoc::SaveStr ( TStr Str)

Definition at line 1442 of file xml.cpp.

References TMOut::GetAsStr(), TMOut::New(), and SaveTxt().

                              {
  PSOut SOut=TMOut::New(); TMOut& MOut=*(TMOut*)SOut();
  SaveTxt(SOut);
  Str=MOut.GetAsStr();
}

Here is the call graph for this function:

void SaveTxt ( const PSOut SOut)

Definition at line 381 of file xml.h.

References GetTok(), and GetTokStr().

                                 {
    SOut->PutStr(GetTok()->GetTokStr());}

Here is the call graph for this function:

void SaveTxt ( const TStr FNm,
const bool &  Append = false 
)

Definition at line 383 of file xml.h.

References TFOut::New(), and SaveTxt().

                                                         {
    PSOut SOut=TFOut::New(FNm, Append); SaveTxt(SOut);}

Here is the call graph for this function:

void SetChTy ( TBSet ChSet,
const int &  MnCh,
const int &  MxCh = -1 
)
void SetChTy ( TBSet ChSet,
const TStr Str 
)
void TXmlChDef::SetEntityVal ( const TStr Nm,
const TStr Val 
)

Definition at line 204 of file xml.cpp.

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

Referenced by TXmlChDef().

                                                           {
  EntityNmToValH.AddDat(Nm, Val);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool TXmlDoc::SkipTopTag ( const PSIn SIn) [static]

Definition at line 1377 of file xml.cpp.

References TXmlLx::GetSym(), LoadTxtMiscStar(), TXmlLx::Sym, xspIntact, xsyDocTypeDecl, and xsyXmlDecl.

                                       {
  bool Ok=true;
  TXmlLx Lx(SIn, xspIntact);
  try {
    Lx.GetSym();
    // [22] prolog ::=  XMLDecl? Misc* (doctypedecl Misc*)?
    if (Lx.Sym==xsyXmlDecl){Lx.GetSym();}
    LoadTxtMiscStar(Lx);
    if (Lx.Sym==xsyDocTypeDecl){Lx.GetSym();}
    LoadTxtMiscStar(Lx);
    Ok=true;
  }
  catch (PExcept Except){
    Ok=false;
  }
  return Ok;
}

Here is the call graph for this function:

Definition at line 208 of file xml.cpp.

References CharChSet, CombChSet, DigitChSet, ExtChSet, LetterChSet, TUCh::Mx, NameChSet, PubidChSet, SetChTy(), SetEntityVal(), and TBSet().

Referenced by Load().

                    :
  Chs(TUCh::Vals),
  CharChSet(), CombChSet(), ExtChSet(),
  LetterChSet(), DigitChSet(), NameChSet(), PubidChSet(),
  EntityNmToValH(100){

  // Character-Sets
  // Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | ...
  CharChSet.Gen(Chs);
  // ... because of DMoz (temporary patch)
  SetChTy(CharChSet, 0x1); SetChTy(CharChSet, 0x3); SetChTy(CharChSet, 0x6);
  SetChTy(CharChSet, 11); SetChTy(CharChSet, 24); SetChTy(CharChSet, 27);
  // regular characters
  SetChTy(CharChSet, 0x9); SetChTy(CharChSet, 0xA); SetChTy(CharChSet, 0xD);
  SetChTy(CharChSet, 0x20, TUCh::Mx);
  // BaseChar ::=  [#x0041-#x005A] | [#x0061-#x007A] | [#x00C0-#x00D6] |
  //  [#x00D8-#x00F6] | [#x00F8-#x00FF] | ...
  TBSet BaseChSet(Chs);
  SetChTy(BaseChSet, 0x41, 0x5A); SetChTy(BaseChSet, 0x61, 0x7A);
  SetChTy(BaseChSet, 0xC0, 0xD6); SetChTy(BaseChSet, 0xD8, 0xF6);
  SetChTy(BaseChSet, 0xF8, 0xFF);
  // Ideographic ::= ...
  TBSet IdeoChSet(Chs);
  // CombiningChar ::= ...
  CombChSet.Gen(Chs);
  // Extender ::=  #x00B7 | ...
  ExtChSet.Gen(Chs);
  SetChTy(ExtChSet, 0xB7);
  // Letter ::=  BaseChar | Ideographic
  LetterChSet=BaseChSet|IdeoChSet;
  // Digit ::=  [#x0030-#x0039] | ...
  DigitChSet.Gen(Chs);
  SetChTy(DigitChSet, 0x30, 0x39);
  // NameChar ::=  Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar
  NameChSet=LetterChSet|DigitChSet|
   uchar('.')|uchar('-')|uchar('_')|uchar(':')|CombChSet;
  // PubidChar ::=  #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
  PubidChSet.Gen(Chs);
  SetChTy(PubidChSet, 0x20); SetChTy(PubidChSet, 0xD); SetChTy(PubidChSet, 0xA);
  SetChTy(PubidChSet, 'a', 'z'); SetChTy(PubidChSet, 'A', 'Z');
  SetChTy(PubidChSet, '0', '9'); SetChTy(PubidChSet, "-'()+,./:=?;!*#@$_%");

  // Standard-Entity-Sequences
  SetEntityVal("amp", "&");
  SetEntityVal("lt", "<"); SetEntityVal("gt", ">");
  SetEntityVal("apos", "'"); SetEntityVal("quot", "\"");
}

Here is the call graph for this function:

Here is the caller graph for this function:

TXmlChDef ( TSIn SIn)

Definition at line 51 of file xml.h.

                      :
    Chs(SIn),
    CharChSet(SIn), CombChSet(SIn), ExtChSet(SIn),
    LetterChSet(SIn), DigitChSet(SIn), NameChSet(SIn), PubidChSet(SIn),
    EntityNmToValH(SIn){}
TXmlDoc ( )

Definition at line 332 of file xml.h.

Referenced by New().

: Ok(false), MsgStr(), Tok(){}

Here is the caller graph for this function:

TXmlDoc ( const PXmlTok _Tok)

Definition at line 334 of file xml.h.

: Ok(!_Tok.Empty()), MsgStr(), Tok(_Tok){}
TXmlDoc ( TSIn )

Definition at line 336 of file xml.h.

References Fail.

{Fail;}
TXmlTok ( )

Definition at line 203 of file xml.h.

Referenced by GetTagTok(), and New().

: Sym(xsyUndef), Str(), ArgNmValV(), SubTokV(){}

Here is the caller graph for this function:

TXmlTok ( const TXmlLxSym _Sym)

Definition at line 204 of file xml.h.

                                :
    Sym(_Sym), Str(), ArgNmValV(), SubTokV(){}
TXmlTok ( const TXmlLxSym _Sym,
const TStr _Str 
)

Definition at line 206 of file xml.h.

                                                  :
    Sym(_Sym), Str(_Str), ArgNmValV(), SubTokV(){}
TXmlTok ( const TXmlLxSym _Sym,
const TStr _Str,
const TStrKdV _ArgNmValV 
)

Definition at line 208 of file xml.h.

                                                                             :
    Sym(_Sym), Str(_Str), ArgNmValV(_ArgNmValV){}
TXmlTok ( TSIn )

Definition at line 232 of file xml.h.

References Fail.

{Fail;}

Variable Documentation

Definition at line 200 of file xml.h.

ClassTP (TXmlChDef, PXmlChDef) private TBSet CharChSet

Definition at line 40 of file xml.h.

Referenced by IsChar(), Save(), and TXmlChDef().

ClassTP (TXmlChDef, PXmlChDef) private TBSet CombChSet

Definition at line 40 of file xml.h.

Referenced by IsComb(), Save(), and TXmlChDef().

Definition at line 44 of file xml.h.

Referenced by IsDigit(), Save(), and TXmlChDef().

Definition at line 45 of file xml.h.

Referenced by IsEntityNm(), Save(), and SetEntityVal().

ClassTP (TXmlChDef, PXmlChDef) private TBSet ExtChSet

Definition at line 40 of file xml.h.

Referenced by IsExt(), Save(), and TXmlChDef().

Definition at line 44 of file xml.h.

Referenced by IsLetter(), Save(), and TXmlChDef().

ClassTPV (TXmlDoc, PXmlDoc, TXmlDocV) private TStr MsgStr

Definition at line 324 of file xml.h.

Definition at line 44 of file xml.h.

Referenced by IsName(), Save(), and TXmlChDef().

Definition at line 44 of file xml.h.

Referenced by IsPubid(), Save(), and TXmlChDef().

ClassTPV (TXmlTok, PXmlTok, TXmlTokV) private TStr Str

Definition at line 196 of file xml.h.

TXmlTokV SubTokV

Definition at line 201 of file xml.h.

Referenced by AddSubTok(), ClrSubTok(), GetSubTok(), GetSubToks(), GetTagTok(), and PutSubTok().