SNAP Library, User 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

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.

                                                    {
    ArgNmValV.Add(TStrKd(ArgNm, TBool::GetStr(ArgVal)));}
void AddArg ( const TStr ArgNm,
const int &  ArgVal 
)

Definition at line 252 of file xml.h.

                                                   {
    ArgNmValV.Add(TStrKd(ArgNm, TInt::GetStr(ArgVal)));}
void AddArg ( const TStr ArgNm,
const uint64 ArgVal 
)

Definition at line 254 of file xml.h.

                                                      {
    ArgNmValV.Add(TStrKd(ArgNm, TUInt64::GetStr(ArgVal)));}
void AddArg ( const TStr ArgNm,
const double &  ArgVal 
)

Definition at line 256 of file xml.h.

                                                      {
    ArgNmValV.Add(TStrKd(ArgNm, TFlt::GetStr(ArgVal)));}
void AddArg ( const TStr ArgNm,
const TStr ArgVal 
)

Definition at line 258 of file xml.h.

                                                    {
    ArgNmValV.Add(TStrKd(ArgNm, ArgVal));}
void AddSubTok ( const PXmlTok Tok)

Definition at line 290 of file xml.h.

{SubTokV.Add(Tok);}
void TXmlTok::AddTokToChA ( const bool &  XmlP,
TChA ChA 
) const

Definition at line 1179 of file xml.cpp.

                                                           {
  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;
  }
}
void ClrSubTok ( )

Definition at line 293 of file xml.h.

{SubTokV.Clr();}
void GetArg ( const int &  ArgN,
TStr ArgNm,
TStr ArgVal 
) const

Definition at line 261 of file xml.h.

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

Definition at line 260 of file xml.h.

{return ArgNmValV.Len();}
TStr GetArgVal ( const TStr ArgNm) const

Definition at line 271 of file xml.h.

                                          {
    return ArgNmValV[ArgNmValV.SearchForw(TStrKd(ArgNm))].Dat;}
TStr GetArgVal ( const TStr ArgNm,
const TStr DfArgVal 
) const

Definition at line 273 of file xml.h.

                                                                {
    int ArgN=ArgNmValV.SearchForw(TStrKd(ArgNm));
    return (ArgN==-1) ? DfArgVal : ArgNmValV[ArgN].Dat;}
bool TXmlTok::GetBoolArgVal ( const TStr ArgNm,
const bool &  DfVal = false 
) const

Definition at line 1083 of file xml.cpp.

                                                                      {
  int ArgN=ArgNmValV.SearchForw(TStrKd(ArgNm));
  return (ArgN==-1) ? DfVal : (ArgNmValV[ArgN].Dat==TBool::TrueStr);
}
bool TXmlTok::GetBoolArgVal ( const TStr ArgNm,
const TStr TrueVal,
const bool &  DfVal = false 
) const

Definition at line 1088 of file xml.cpp.

                                                                  {
  int ArgN=ArgNmValV.SearchForw(TStrKd(ArgNm));
  return (ArgN==-1) ? DfVal : (ArgNmValV[ArgN].Dat==TrueVal);
}
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.

                                                                     {
  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;
}
double TXmlTok::GetFltArgVal ( const TStr ArgNm,
const double &  DfVal = 0 
) const

Definition at line 1113 of file xml.cpp.

                                                                         {
  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;}
  }
}
int TXmlTok::GetIntArgVal ( const TStr ArgNm,
const int &  DfVal = 0 
) const

Definition at line 1103 of file xml.cpp.

                                                                   {
  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;}
  }
}
TStr GetMsgStr ( ) const

Definition at line 344 of file xml.h.

{return MsgStr;}
TStr GetStr ( ) const

Definition at line 242 of file xml.h.

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

Definition at line 1123 of file xml.cpp.

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

Definition at line 292 of file xml.h.

{return SubTokV[SubTokN];}
int GetSubToks ( ) const

Definition at line 291 of file xml.h.

{return SubTokV.Len();}
TXmlLxSym GetSym ( ) const

Definition at line 239 of file xml.h.

{return Sym;}
TStr GetSymStr ( ) const

Definition at line 240 of file xml.h.

{return TXmlLx::GetXmlLxSymStr(Sym);}
TStr GetTagNm ( ) const

Definition at line 247 of file xml.h.

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

Definition at line 1136 of file xml.cpp.

                                                    {
  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);}
  }
}
bool TXmlDoc::GetTagTokBoolArgVal ( const TStr TagPath,
const TStr ArgNm,
const bool &  DfVal = false 
) const

Definition at line 1326 of file xml.cpp.

                                                                  {
  PXmlTok TagTok;
  if (IsTagTok(TagPath, TagTok)){
    return TagTok->GetBoolArgVal(ArgNm, DfVal);}
  else {return DfVal;}
}
double TXmlDoc::GetTagTokFltArgVal ( const TStr TagPath,
const TStr ArgNm,
const double &  DfVal = 0 
) const

Definition at line 1342 of file xml.cpp.

                                                                    {
  PXmlTok TagTok;
  if (IsTagTok(TagPath, TagTok)){
    return TagTok->GetFltArgVal(ArgNm, DfVal);}
  else {return DfVal;}
}
int TXmlDoc::GetTagTokIntArgVal ( const TStr TagPath,
const TStr ArgNm,
const int &  DfVal = 0 
) const

Definition at line 1334 of file xml.cpp.

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

Definition at line 305 of file xml.h.

                                               {
    return GetTagTok(TagPath)->GetTokStr(false);}
TStr TXmlDoc::GetTagTokStrArgVal ( const TStr TagPath,
const TStr ArgNm,
const TStr DfVal = TStr() 
) const

Definition at line 1350 of file xml.cpp.

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

Definition at line 307 of file xml.h.

                                                                             {
    PXmlTok TagTok;
    if (IsTagTok(TagPath, TagTok)){return TagTok->GetTokStr(false);}
    else {return DfVal;}}
void GetTagTokV ( const TStr TagPath,
TXmlTokV &  XmlTokV 
) const

Definition at line 1152 of file xml.cpp.

                                                                     {
  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);}
    }
  }
}
TStr GetTagVal ( const TStr TagNm,
const bool &  XmlP 
) const

Definition at line 359 of file xml.h.

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

Definition at line 1165 of file xml.cpp.

                                                                               {
  if ((Sym==xsyTag)&&(Str==TagNm)){
    ValV.Add(GetTokStr(XmlP));
  } else {
    for (int SubTokN=0; SubTokN<GetSubToks(); SubTokN++){
      GetSubTok(SubTokN)->GetTagValV(TagNm, XmlP, ValV);}
  }
}
static PXmlTok GetTok ( TXmlLx Lx) [static]
PXmlTok GetTok ( ) const

Definition at line 345 of file xml.h.

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

Definition at line 314 of file xml.h.

                                              {
    TChA ChA; AddTokToChA(XmlP, ChA); return ChA;}
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.

                                      {
  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;
}
bool IsArg ( const TStr ArgNm) const

Definition at line 263 of file xml.h.

                                      {
    return ArgNmValV.SearchForw(TStrKd(ArgNm))!=-1;}
bool IsArg ( const TStr ArgNm,
TStr ArgVal 
) const

Definition at line 265 of file xml.h.

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

Definition at line 66 of file xml.h.

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

Definition at line 67 of file xml.h.

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

Definition at line 70 of file xml.h.

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

Definition at line 81 of file xml.h.

                                                               {
    return EntityNmToValH.IsKeyGetDat(EntityNm, EntityVal);}
bool IsEoln ( const uchar Ch) const

Definition at line 78 of file xml.h.

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

Definition at line 68 of file xml.h.

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

Definition at line 76 of file xml.h.

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

Definition at line 69 of file xml.h.

{return LetterChSet.GetBit(Ch);}
bool IsName ( const uchar Ch) const

Definition at line 71 of file xml.h.

{return NameChSet.GetBit(Ch);}
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.

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

Definition at line 286 of file xml.h.

                                         {
    return !GetTagTok(TagNm).Empty();}
bool IsSubTag ( const TStr TagNm,
PXmlTok Tok 
) const

Definition at line 288 of file xml.h.

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

Definition at line 245 of file xml.h.

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

Definition at line 246 of file xml.h.

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

Definition at line 297 of file xml.h.

                                                            {
    TagTok=GetTagTok(TagPath); return !TagTok.Empty();}
bool IsTagTok ( const TStr TagPath) const

Definition at line 299 of file xml.h.

                                           {
    PXmlTok TagTok; return IsTagTok(TagPath, TagTok);}
bool IsWs ( const uchar Ch) const

Definition at line 74 of file xml.h.

                                   {
    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.

{return new TXmlChDef(SIn);}
PXmlDoc TXmlDoc::LoadStr ( const TStr Str) [static]

Definition at line 1437 of file xml.cpp.

                                       {
  PSIn SIn=TStrIn::New(Str);
  return LoadTxt(SIn);
}
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.

                                         {
  // [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;
}
void TXmlDoc::LoadTxtMiscStar ( TXmlLx Lx) [static]

Definition at line 1237 of file xml.cpp.

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

Definition at line 210 of file xml.h.

{return PXmlTok(new TXmlTok());}
static PXmlTok New ( const TXmlLxSym Sym) [static]

Definition at line 211 of file xml.h.

{return PXmlTok(new TXmlTok(Sym));}
static PXmlTok New ( const TXmlLxSym Sym,
const TStr Str 
) [static]

Definition at line 212 of file xml.h.

                                                           {
    return PXmlTok(new TXmlTok(Sym, Str));}
static PXmlTok New ( const TXmlLxSym Sym,
const TStr Str,
const TStrKdV ArgNmValV 
) [static]

Definition at line 214 of file xml.h.

                                                                   {
    return PXmlTok(new TXmlTok(Sym, Str, ArgNmValV));}
static PXmlTok New ( const TStr TagNm,
const TStrKdV ArgNmValV 
) [static]

Definition at line 217 of file xml.h.

                                               {
    return PXmlTok(new TXmlTok(xsyTag, TagNm, ArgNmValV));}
static PXmlTok New ( const TStr TagNm) [static]

Definition at line 220 of file xml.h.

                                       {
    return PXmlTok(new TXmlTok(xsyTag, TagNm));}
static PXmlTok New ( const TStr TagNm,
const TStr ValStr 
) [static]

Definition at line 222 of file xml.h.

                                                           {
    PXmlTok TagXmlTok=PXmlTok(new TXmlTok(xsyTag, TagNm));
    PXmlTok StrXmlTok=PXmlTok(new TXmlTok(xsyStr, ValStr));
    TagXmlTok->AddSubTok(StrXmlTok); return TagXmlTok;}
static PXmlTok New ( const TStr TagNm,
const PXmlTok XmlTok1,
const PXmlTok XmlTok2 = NULL 
) [static]

Definition at line 226 of file xml.h.

                                                       {
    PXmlTok TagXmlTok=PXmlTok(new TXmlTok(xsyTag, TagNm));
    if (!XmlTok1.Empty()){TagXmlTok->AddSubTok(XmlTok1);}
    if (!XmlTok2.Empty()){TagXmlTok->AddSubTok(XmlTok2);}
    return TagXmlTok;}
static PXmlDoc New ( const PXmlTok Tok) [static]

Definition at line 335 of file xml.h.

{return PXmlDoc(new TXmlDoc(Tok));}
TXmlChDef& operator= ( const TXmlChDef )

Definition at line 64 of file xml.h.

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

Definition at line 236 of file xml.h.

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

Definition at line 340 of file xml.h.

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

Definition at line 269 of file xml.h.

                                                       {
    ArgNmValV[ArgNmValV.SearchForw(TStrKd(ArgNm))].Dat=ArgVal;}
void PutStr ( const TStr _Str)

Definition at line 241 of file xml.h.

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

Definition at line 1128 of file xml.cpp.

                                                             {
  if (SubTokN==-1){
    ClrSubTok(); AddSubTok(Tok);
  } else {
    SubTokV[SubTokN]=Tok;
  }
}
void TXmlDoc::PutTagTokStr ( const TStr TagPath,
const TStr TokStr 
) const

Definition at line 1306 of file xml.cpp.

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

Definition at line 57 of file xml.h.

                        {
    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);}
void TXmlDoc::SaveStr ( TStr Str)

Definition at line 1442 of file xml.cpp.

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

Definition at line 381 of file xml.h.

                                 {
    SOut->PutStr(GetTok()->GetTokStr());}
void SaveTxt ( const TStr FNm,
const bool &  Append = false 
)

Definition at line 383 of file xml.h.

                                                         {
    PSOut SOut=TFOut::New(FNm, Append); SaveTxt(SOut);}
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.

                                                           {
  EntityNmToValH.AddDat(Nm, Val);
}
bool TXmlDoc::SkipTopTag ( const PSIn SIn) [static]

Definition at line 1377 of file xml.cpp.

                                       {
  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;
}

Definition at line 208 of file xml.cpp.

                    :
  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", "\"");
}
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.

: Ok(false), MsgStr(), Tok(){}
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.

{Fail;}
TXmlTok ( )

Definition at line 203 of file xml.h.

: Sym(xsyUndef), Str(), ArgNmValV(), SubTokV(){}
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.

{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.

ClassTP (TXmlChDef, PXmlChDef) private TBSet CombChSet

Definition at line 40 of file xml.h.

Definition at line 44 of file xml.h.

Definition at line 45 of file xml.h.

ClassTP (TXmlChDef, PXmlChDef) private TBSet ExtChSet

Definition at line 40 of file xml.h.

Definition at line 44 of file xml.h.

ClassTPV (TXmlDoc, PXmlDoc, TXmlDocV) private TStr MsgStr

Definition at line 324 of file xml.h.

Definition at line 44 of file xml.h.

Definition at line 44 of file xml.h.

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.

Definition at line 328 of file xml.h.