SNAP Library, Developer Reference
2012-10-02 12:56:23
SNAP, a general purpose network analysis and graph mining library
|
Go to the source code of this file.
Classes | |
class | TXmlObjSer |
class | TXmlObjSerTagNm |
class | TXmlLx |
class | TXmlParser |
Typedefs | |
typedef TPt< TXmlParser > | PXmlParser |
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) |
TXmlChDef & | operator= (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 &) | |
TXmlTok & | operator= (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 &) | |
TXmlDoc & | operator= (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 TPt<TXmlParser> PXmlParser |
enum TXmlLxSym |
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.
{ xsyUndef, xsyWs, xsyComment, xsyXmlDecl, xsyPI, xsyDocTypeDecl, xsyElement, xsyAttList, xsyEntity, xsyNotation, xsyTag, xsySTag, xsyETag, xsySETag, xsyStr, xsyQStr, xsyEof} TXmlLxSym;
enum TXmlSpacing |
Definition at line 250 of file xml.h.
References TVec< TVal >::Add(), ArgNmValV, and TBool::GetStr().
{ ArgNmValV.Add(TStrKd(ArgNm, TBool::GetStr(ArgVal)));}
Definition at line 252 of file xml.h.
References TVec< TVal >::Add(), ArgNmValV, and TInt::GetStr().
{ ArgNmValV.Add(TStrKd(ArgNm, TInt::GetStr(ArgVal)));}
Definition at line 254 of file xml.h.
References TVec< TVal >::Add(), ArgNmValV, and TUInt64::GetStr().
{ ArgNmValV.Add(TStrKd(ArgNm, TUInt64::GetStr(ArgVal)));}
Definition at line 256 of file xml.h.
References TVec< TVal >::Add(), ArgNmValV, and TFlt::GetStr().
{ ArgNmValV.Add(TStrKd(ArgNm, TFlt::GetStr(ArgVal)));}
Definition at line 290 of file xml.h.
References SubTokV.
Referenced by PutSubTok().
{SubTokV.Add(Tok);}
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; } }
void ClrSubTok | ( | ) |
Definition at line 293 of file xml.h.
References SubTokV.
Referenced by PutSubTok().
{SubTokV.Clr();}
int GetArgs | ( | ) | const |
Definition at line 260 of file xml.h.
References ArgNmValV, and TVec< TVal >::Len().
Referenced by AddTokToChA().
Definition at line 271 of file xml.h.
References ArgNmValV, and TVec< TVal >::SearchForw().
{ return ArgNmValV[ArgNmValV.SearchForw(TStrKd(ArgNm))].Dat;}
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;}
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); }
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); }
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; }
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;} } }
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;} } }
Definition at line 242 of file xml.h.
References Str.
Referenced by TXmlLx::EThrow(), Eval(), TXmlLx::GetFPosStr(), GetFullStr(), TTmInfo::GetHmFromMins(), TEnv::GetIfArgPrefixBool(), TEnv::GetIfArgPrefixFlt(), TEnv::GetIfArgPrefixInt(), THttp::GetReasonPhrase(), TGnuPlot::GetSeriesPlotStr(), TXmlLx::GetXmlStrFromPlainMem(), TXmlLx::GetXmlStrFromPlainStr(), IsRedirUrlTok(), IsUrlTok(), and TGHash< TDat >::SaveDetailTxt().
{return Str;}
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; }
Definition at line 292 of file xml.h.
References SubTokV.
Referenced by AddTokToChA(), and GetTagValV().
{return SubTokV[SubTokN];}
int GetSubToks | ( | ) | const |
Definition at line 291 of file xml.h.
References SubTokV.
Referenced by AddTokToChA(), and GetTagValV().
{return SubTokV.Len();}
Definition at line 240 of file xml.h.
References TXmlLx::GetXmlLxSymStr().
Referenced by TOLx::PutSym().
{return TXmlLx::GetXmlLxSymStr(Sym);}
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);} } }
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;} }
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;} }
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;} }
TStr GetTagTokStr | ( | const TStr & | TagPath | ) | const |
Definition at line 305 of file xml.h.
References GetTagTok().
{ 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.
References IsTagTok().
{ 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.
References IsTagTok().
{ 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.
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);} } } }
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 "";}}
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);} } }
Definition at line 314 of file xml.h.
References AddTokToChA().
Referenced by GetTagValV(), and SaveTxt().
{ TChA ChA; AddTokToChA(XmlP, ChA); return ChA;}
TStr TXmlTok::GetTokVStr | ( | const TXmlTokV & | TokV, |
const bool & | XmlP = true |
||
) | [static] |
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+="&";} else if (Ch=='>'){XmlChA+="<";} else if (Ch=='<'){XmlChA+=">";} else if (Ch=='\''){XmlChA+="'";} else if (Ch=='\"'){XmlChA+=""";} else {XmlChA+=Ch;} } else { XmlChA+="&#"; XmlChA+=TUInt::GetStr(Ch); XmlChA+=";"; } } return XmlChA; }
Definition at line 263 of file xml.h.
References ArgNmValV, and TVec< TVal >::SearchForw().
{ return ArgNmValV.SearchForw(TStrKd(ArgNm))!=-1;}
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;}
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);}
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==':');}
Definition at line 69 of file xml.h.
References LetterChSet.
Referenced by IsFirstNameCh().
{return LetterChSet.GetBit(Ch);}
Definition at line 71 of file xml.h.
References NameChSet.
Referenced by TXmlLx::IsTagNm().
{return NameChSet.GetBit(Ch);}
Definition at line 286 of file xml.h.
References TPt< TRec >::Empty(), and GetTagTok().
Definition at line 288 of file xml.h.
References TPt< TRec >::Empty(), and GetTagTok().
bool IsTag | ( | ) | const |
Definition at line 297 of file xml.h.
References TPt< TRec >::Empty(), and GetTagTok().
Referenced by GetTagTokBoolArgVal(), GetTagTokFltArgVal(), GetTagTokIntArgVal(), GetTagTokStrArgVal(), GetTagTokStrOrDf(), and IsTagTok().
Definition at line 299 of file xml.h.
References IsTagTok().
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);}
Definition at line 56 of file xml.h.
References TXmlChDef().
{return new TXmlChDef(SIn);}
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); }
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] |
PXmlTok TXmlDoc::LoadTxtElement | ( | TXmlLx & | Lx | ) | [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; }
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();} }
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;}
Definition at line 269 of file xml.h.
References ArgNmValV, and TVec< TVal >::SearchForw().
{ ArgNmValV[ArgNmValV.SearchForw(TStrKd(ArgNm))].Dat=ArgVal;}
void TXmlTok::PutSubTok | ( | const PXmlTok & | Tok, |
const int & | SubTokN = -1 |
||
) |
Definition at line 1128 of file xml.cpp.
References AddSubTok(), ClrSubTok(), SubTokV, and Tok.
void TXmlDoc::PutTagTokStr | ( | const TStr & | TagPath, |
const TStr & | TokStr | ||
) | const |
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);}
void TXmlDoc::SaveStr | ( | TStr & | Str | ) |
Definition at line 1442 of file xml.cpp.
References TMOut::GetAsStr(), TMOut::New(), and SaveTxt().
Definition at line 383 of file xml.h.
References TFOut::New(), and SaveTxt().
{ PSOut SOut=TFOut::New(FNm, Append); SaveTxt(SOut);}
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); }
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; }
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", "\""); }
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 | ( | ) |
TXmlTok | ( | ) |
Definition at line 40 of file xml.h.
Referenced by IsChar(), Save(), and TXmlChDef().
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().
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().
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().
TXmlTokV SubTokV |
Definition at line 201 of file xml.h.
Referenced by AddSubTok(), ClrSubTok(), GetSubTok(), GetSubToks(), GetTagTok(), and PutSubTok().
Definition at line 328 of file xml.h.
Referenced by GetOutDescUrlStrKdV(), GetOutUrlV(), GetTagTokV(), GetTok(), LoadTxtElement(), PutSubTok(), PutTagTokStr(), and THtmlHldV().