SNAP Library , User Reference
2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <xml.h>
Public Member Functions | |
TXmlParser (const PSIn &_SIn) | |
TXmlLxSym | GetSym () |
TXmlLxSym | GetSym (TChA &_SymStr) |
TXmlLxSym | PeekSym () |
TXmlLxSym | PeekSym (TChA &_SymStr) |
void | SkipTillTag (const TChA &_SymStr) |
TXmlLxSym | GetTag (const TChA &TagStr) |
void | GetTagVal (const TChA &TagStr, TChA &TagVal) |
Static Public Member Functions | |
static PXmlParser | New (const PSIn &SIn) |
static void | GetPlainStrFromXmlStr (const TChA &XmlStr, TChA &PlainChA) |
Public Attributes | |
TXmlLxSym | Sym |
TXmlLxSym | NextSym |
TChA | SymStr |
TChA | NextSymStr |
Private Member Functions | |
char | GetCh () |
Private Attributes | |
TCRef | CRef |
PSIn | SIn |
TSIn & | RSIn |
TChA | _SymStr |
Friends | |
class | TPt< TXmlParser > |
TXmlParser::TXmlParser | ( | const PSIn & | _SIn | ) | [inline] |
char TXmlParser::GetCh | ( | ) | [inline, private] |
void TXmlParser::GetPlainStrFromXmlStr | ( | const TChA & | XmlStr, |
TChA & | PlainChA | ||
) | [static] |
Definition at line 1525 of file xml.cpp.
{ static TChA EntityNm; PlainChA.Clr(); const char *Ch = XmlStr.CStr(); while (*Ch){ if (*Ch!='&'){ PlainChA+=*Ch; Ch++; } else { if (*++Ch=='#'){ TChA RefChA; int RefCd=0; if (*++Ch=='x'){ forever { Ch++; if (TCh::IsHex(*Ch)){ RefChA+=*Ch; RefCd=RefCd*16+TCh::GetHex(*Ch); } else { break; } } } else { // decimal character code forever { if (TCh::IsNum(*Ch)){ RefChA+=*Ch; RefCd=RefCd*10+TCh::GetNum(*Ch); } else { break; } Ch++; } } if ((!RefChA.Empty())&&(*Ch==';')){ Ch++; const uchar RefCh=uchar(RefCd); PlainChA+=RefCh; } } else { EntityNm.Clr(); while ((*Ch)&&(*Ch!=';')){EntityNm+=*Ch; Ch++;} if ((!EntityNm.Empty())&&(*Ch==';')){ Ch++; if (EntityNm=="quot"){PlainChA+='"';} else if (EntityNm=="amp"){PlainChA+='&';} else if (EntityNm=="apos"){PlainChA+='\'';} else if (EntityNm=="lt"){PlainChA+='<';} else if (EntityNm=="gt"){PlainChA+='>';} } } } } }
Definition at line 1451 of file xml.cpp.
{ if (NextSym != xsyUndef) { Sym = NextSym; NextSym=xsyUndef; SymStr=NextSymStr; NextSymStr.Clr(); return Sym; } SymStr.Clr(); char Ch; while (TCh::IsWs(Ch=GetCh())) { } if (Ch == TCh::EofCh) { Sym = xsyEof; return xsyEof; } if (Ch == '<') { // load tag Ch = GetCh(); if (Ch == '/') { Sym = xsyETag; } else { Sym = xsySTag; SymStr.Push(Ch); } while((Ch=GetCh())!='>' && Ch!=TCh::EofCh) { SymStr.Push(Ch); } const int StrLen = SymStr.Len(); if (StrLen > 1 && SymStr[StrLen-1] == '/') { Sym = xsyETag; SymStr[StrLen-1] = 0; for (char *c = SymStr.CStr()+StrLen-2; TCh::IsWs(*c); c--) { *c=0; } } } else { // load string _SymStr.Clr(); _SymStr.Push(Ch); while (! RSIn.Eof() && RSIn.PeekCh() != '<') { _SymStr.Push(GetCh()); } GetPlainStrFromXmlStr(_SymStr, SymStr); Sym = xsyStr; } if (Ch == TCh::EofCh) { SymStr.Clr(); Sym = xsyEof; return xsyEof; } return Sym; }
TXmlLxSym TXmlParser::GetSym | ( | TChA & | _SymStr | ) |
TXmlLxSym TXmlParser::GetTag | ( | const TChA & | TagStr | ) |
void TXmlParser::GetTagVal | ( | const TChA & | TagStr, |
TChA & | TagVal | ||
) |
static PXmlParser TXmlParser::New | ( | const PSIn & | SIn | ) | [inline, static] |
Definition at line 410 of file xml.h.
{ return new TXmlParser(SIn); }
TXmlLxSym TXmlParser::PeekSym | ( | TChA & | _SymStr | ) |
Definition at line 1498 of file xml.cpp.
{ PeekSym(); _SymStr = NextSymStr; return NextSym; }
void TXmlParser::SkipTillTag | ( | const TChA & | _SymStr | ) |
friend class TPt< TXmlParser > [friend] |
TChA TXmlParser::_SymStr [private] |
TCRef TXmlParser::CRef [private] |
TSIn& TXmlParser::RSIn [private] |
PSIn TXmlParser::SIn [private] |