Return TypeFunction nameArguments
hzEcodehzDocHtml::Load(hzChain&,)

Declared in file: hzDocument.h
Defined in file : hzDocHtml.cpp

Function Logic:

0:START 1:hzDocHtml::Clear hzDocHtml::_htmPreproc rc 2:rc!=E_OK 3:Return rc 4:m_Content hzMapS::Count 5:!s_htagNam.Count() 6:InitHtml 7:zi hzChain::Iter::Skipwhite hzChain::Iter::Equiv 8:zi.Equiv( 9:quote zi 10:!zi.eof(); 11:quote 12:*zi==(char)34 13:quote 14:*zi==(char)62 15:items 16:*zi==(char)34 17:quote 18:hzChain::Iter::Skipwhite 19:!zi.eof(); 20:zi.Equiv( 21:hzDocHtml::_proctag m_pRoot 22:!m_pRoot 23:Return E_FORMAT 24:!m_pRoot 25:zi hzChain::Iter::Skipwhite pCN hzVect::Count hzChain::Iter::Line hzHtmElem::Init hzVect::Add 26:!zi.eof(); 27:zi.Equiv( 28:hzDocHtml::_proctag m_pHead 29:!m_pHead 30:Return E_FORMAT 31:items 32:!m_pHead 33:Return E_FORMAT 34:pCN 35:rc==E_OK&&pCN&&!zi.eof(); 36:*zi!=(char)60 37:zi==// 38:!zi.eof()&&*zi!=(char)10; 39:*zi<=(char)32&&pCN->m_tmpContent.Size()==0 40:items 41:hzChain::AddByte items 42:hzChain::Iter::Line nLine 43:zi== 48:zi 49:zi== 50:!zi.eof(); 51:zi== 52:zi 53:zi== 54:zi 55:zi== 58:zi 59:zi== </tspan> </text> <polygon points="426,2038 442,2022 506,2022 522,2038, 506,2054, 442,2054" style="fill:#ffffe0;stroke:#000000;stroke-width:1"/> <text fill="#000000" dominant-baseline="top"> <tspan x="426" dy="2042">60:!zi.eof(); </tspan> </text> <polygon points="568,2038 584,2022 648,2022 664,2038, 648,2054, 584,2054" style="fill:#ffffe0;stroke:#000000;stroke-width:1"/> <text fill="#000000" dominant-baseline="top"> <tspan x="568" dy="2042">61:zi== 62:zi 63:hzChain::AddByte 64:zi== 65:!zi.eof(); 66:zi== 67:zi 68:zi.eof() 69:rc 70:hzString::Clear hzString::Clear limit items hzChain::AddByte bAnti 71:*limit==(char)47 72:hzChain::AddByte bAnti items 73:nColon tw_start 74:!limit.eof(); 75:*limit==(char)58||IsAlphanum(*limit) 76:*limit==(char)58 77:items 78:hzChain::AddByte hzChain::AddByte 79:tagword hzChain::Clear 80:!limit.eof(); 81:hzChain::AddByte 82:*limit==(char)34||*limit==(char)39 83:cDelim 84:!limit.eof(); 85:*limit==(char)92 86:items 87:*limit==cDelim 88:*limit==cDelim 89:*limit==(char)62 90:items 91:wholetag hzChain::Clear 92:*limit!=(char)62 93:zi 94:items 95:nColon 96:!s_htagNam.Exists(tagword) 97:tf tf tf hzMapS::Insert hzMapS::Insert 98:!s_htagNam.Exists(tagword) 99:bAnti 100:hzChain::Iter::Line 101:hzChain::Iter::Line hzString::Length 102:items zi 103:tf 104:tf.type==HTAG_NULL 105:bAnti 106:hzChain::Iter::Line 107:hzChain::Iter::Line hzString::Length 108:items zi 109:bAnti==false 110:zi.Equiv() 111:hzDocHtml::_proctag pCN 112:!pCN 113:rc hzChain::Iter::Line 114:zi.Equiv( 115:hzDocHtml::_proctag pCN 116:!pCN 117:rc hzChain::Iter::Line 118:zi.Equiv( 119:hzDocHtml::_proctag pCN 120:!pCN 121:rc hzChain::Iter::Line 122:zi.Equiv( 123:hzDocHtml::_proctag pCN 124:!pCN 125:rc hzChain::Iter::Line 126:zi.Equiv( 127:hzDocHtml::_proctag pCN 128:!pCN 129:rc hzChain::Iter::Line 130:zi.Equiv( 131:hzDocHtml::_proctag pCN 132:!pCN 133:rc hzChain::Iter::Line hzChain::Size 134:pCN->m_tmpContent.Size() 135:m_Base 136:ai hzAttrset::Value 137:ai.Value() 138:hzAttrset::Value m_Base 139:rc hzChain::Iter::Line 140:bAnti 141:zi.Equiv() 142:zi 143:tf.klas==HTCLASS_TXT 144:items zi 145:zi 146:pCN->Type()==tf.type||tf.rule==HTRULE_SINGLE 147:hzHtmElem::Parent pCN 148:hzHtmElem::Type Tagtype2Txt hzHtmElem::GetUid hzHtmElem::Level hzChain::Iter::Line Tagtype2Txt 149:tf.rule==HTRULE_SINGLE 150:hzHtmElem::Parent pCN 151:pCN->Type()==HTAG_TBL_CEL&&tf.type==HTAG_TR 152:pX; 153:pX->Type()==tf.type 154:pCN hzHtmElem::Level 155:items 156:!zi.eof(); 157:zi.Equiv( 158:hzDocHtml::_proctag m_pBody 159:!m_pBody 160:Return E_FORMAT 161:items 162:!m_pBody 163:Return E_FORMAT 164:pCN 165:pCN&&!zi.eof(); 166:*zi!=(char)60 167:pCN->Type()!=HTAG_ANCHOR 168:*zi<=(char)32&&pCN->m_tmpContent.Size()==0 169:items 170:hzChain::AddByte 171:pCN->Parent() 172:hzHtmElem::Parent hzChain::AddByte 173:items 174:hzChain::Iter::Line nLine 175:zi== 176:!zi.eof(); 177:zi== 178:zi 179:zi.eof() 180:rc 181:zi== 182:!zi.eof(); 183:zi== 184:zi 185:zi.eof() 186:rc 187:zi== 188:!zi.eof(); 189:zi== 190:zi 191:zi.eof() 192:rc 193:zi== 198:zi 199:zi.eof() 200:rc 201:zi== 202:!zi.eof(); 203:zi== 204:zi 205:zi== 206:zi 207:zi.eof() 208:rc 209:zi== 212:zi 213:zi.eof() 214:rc 215:hzString::Clear hzString::Clear limit items hzChain::AddByte bAnti 216:*limit==(char)47 217:hzChain::AddByte bAnti items 218:nColon tw_start 219:!limit.eof(); 220:*limit==(char)58||IsAlphanum(*limit) 221:*limit==(char)58 222:items 223:hzChain::AddByte hzChain::AddByte 224:tagword hzChain::Clear 225:!limit.eof(); 226:hzChain::AddByte 227:*limit==(char)34||*limit==(char)39 228:cDelim 229:!limit.eof(); 230:*limit==(char)92 231:items 232:*limit==cDelim 233:*limit==cDelim 234:*limit==(char)62 235:items 236:wholetag hzChain::Clear 237:*limit!=(char)62 238:zi 239:hzString::ToLower 240:nColon 241:!s_htagNam.Exists(tagword) 242:tf tf tf hzMapS::Insert hzMapS::Insert 243:tf 244:tf.type==HTAG_NULL 245:bAnti 246:hzChain::Iter::Line 247:hzChain::Iter::Line hzString::Length 248:items zi 249:bAnti==false 250:tf.klas==HTCLASS_IMG 251:zi 252:tf.klas==HTCLASS_SYS 253:tf.type==HTAG_EMBED 254:items 255:tf.type==HTAG_NOEMBED 256:items 257:!zi.eof(); 258:*zi==(char)62 259:items 260:hzChain::Iter::Line zi 261:tf.klas==HTCLASS_TXT 262:items zi 263:zi.Equiv( 264:!tmp.eof(); 265:tmp.Equiv() 266:tmp zi 267:zi.eof() 268:rc 269:pNN hzDocHtml::_proctag pNN 270:!pNN 271:Tagtype2Txt 272:Return E_FORMAT 273:pCN zi 274:tf.type==HTAG_INPUT 275:hzHtmElem::Parent pCN 276:bAnti 277:tf.klas==HTCLASS_TXT 278:items zi 279:tf.klas==HTCLASS_SYS 280:tf.type==HTAG_EMBED 281:items 282:tf.type==HTAG_NOEMBED 283:items 284:!zi.eof(); 285:*zi==(char)62 286:items 287:hzChain::Iter::Line zi 288:zi 289:pCN->Type()==tf.type||tf.rule==HTRULE_SINGLE 290:hzHtmElem::Parent pCN 291:hzHtmElem::Type Tagtype2Txt hzHtmElem::GetUid hzHtmElem::Level hzChain::Iter::Line Tagtype2Txt 292:tf.rule==HTRULE_SINGLE 293:hzHtmElem::Parent pCN 294:pCN->Type()==HTAG_TBL_CEL&&tf.type==HTAG_TR 295:pX; 296:pX->Type()==tf.type 297:pCN hzHtmElem::Level 298:pCN 299:nX 300:nX 301:pX 302:pX->Type()==HTAG_FORM 303:pCurForm pForm hzList::Add 304:pCurForm 305:pX->Type()==HTAG_INPUT 306:pX->Line()Anti() 307:hzHtmElem::Name P ai 308:ai.Valid(); 309:hzAttrset::Name anam hzAttrset::Value aval 310:anam==value 311:P 312:hzList::Add 313:pX->Line()>pCurForm->Anti() 314:pCurForm 315:hzVect::Count 316:Return rc

Function body:

hzEcode hzDocHtml::Load (hzChain& Z)
{
   _hzfunc("hzDocHtml::Load") ;
   hzChain         nc ;
   hzChain         T ;
   hzChain         W ;
   chIter          zi ;
   chIter          tw_start ;
   chIter          tmp ;
   chIter          limit ;
   hzHtmElem*      pCN = 0;
   hzHtmElem*      pNN ;
   hzHtmElem*      pX ;
   hzHtmElem*      pCurForm = 0;
   hzAttrset       ai ;
   hzHtmForm*      pForm = 0;
   hzPair          P ;
   hzString        strval ;
   hzString        tagword ;
   hzString        wholetag ;
   hzString        anam ;
   hzString        aval ;
   hzHtagform      tf ;
   uint32_t        nX ;
   uint32_t        nColon ;
   uint32_t        nLine ;
   uint32_t        quote ;
   bool            bAnti ;
   int32_t         cDelim ;
   hzEcode         rc = E_OK ;
   Clear() ;
   rc = _htmPreproc(Z) ;
   if (rc != E_OK)
       return rc ;
   m_Content = Z ;
   if (!s_htagNam.Count())
       InitHtml() ;
   zi = Z ;
   zi.Skipwhite() ;
   if (zi.Equiv("<!DOCTYPE"))
   {
       quote = 0;
       for (zi += 9; !zi.eof() ; zi++)
       {
           if (quote)
           {
               if (*zi == CHAR_DQUOTE)
                   quote = 0;
               continue ;
           }
           if (*zi == CHAR_MORE)
               { zi++ ; break ; }
           if (*zi == CHAR_DQUOTE)
               quote = 1;
       }
       zi.Skipwhite() ;
   }
   for (; !zi.eof() ; zi++)
   {
       if (zi.Equiv("<html"))
       {
           m_pRoot = _proctag(0,zi, HTAG_HTML) ;
           if (!m_pRoot)
               { threadLog("Could not establist root node (the <html> tag)\n") ; return E_FORMAT ; }
           break ;
       }
   }
   if (!m_pRoot)
   {
       threadLog("No valid contents found before expected <html> tag - assuming a partial page\n") ;
       zi = Z ;
       zi.Skipwhite() ;
       pCN = new hzHtmElem() ;
       pCN->Init(this, 0,tagword, HTAG_NULL, m_vecTags.Count(), zi.Line()) ;
       m_vecTags.Add(pCN) ;
   }
   else
   {
       for (; !zi.eof() ;)
       {
           if (zi.Equiv("<head"))
           {
               m_pHead = _proctag(m_pRoot, zi, HTAG_HEAD) ;
               if (!m_pHead)
                   { threadLog("Could not process <head> tag\n") ; return E_FORMAT ; }
               break ;
           }
           zi++ ;
       }
       if (!m_pHead)
           { threadLog("Expected a <head> tag\n") ; return E_FORMAT ; }
       pCN = m_pHead ;
       for (; rc == E_OK && pCN && !zi.eof() ;)
       {
           if (*zi != CHAR_LESS)
           {
               if (zi == "//")
               {
                   for (zi += 2; !zi.eof() && *zi != CHAR_NL ; zi++) ;
                   continue ;
               }
               if (*zi <&eq; CHAR_SPACE && pCN->m_tmpContent.Size() == 0)
                   { zi++ ; continue ; }
               pCN->m_tmpContent.AddByte(*zi) ;
               zi++ ;
               continue ;
           }
           nLine = zi.Line() ;
           if (zi == "<!--[if")
           {
               for (zi += 7; !zi.eof() ; zi++)
               {
                   if (zi == "<![endif]>")     { zi += 10;break ; }
                   if (zi == "<![endif]-->")   { zi += 12;break ; }
               }
               continue ;
           }
           if (zi == "<![if")
           {
               for (zi += 5; !zi.eof() ; zi++)
               {
                   if (zi == "<![endif]>")     { zi += 10;break ; }
                   if (zi == "<![endif]-->")   { zi += 12;break ; }
               }
               continue ;
           }
           if (zi == "<!--")
           {
               for (zi += 4; !zi.eof() ; zi++)
               {
                   if (zi == "-->")
                       { zi += 3; break ; }
               }
               continue ;
           }
           //  Handle <![CDATA[...]]> block by converting the innards to straight data (apparently CDATA now legal in HTML)
           if (zi == "<![CDATA[")
           {
               for (zi += 9; !zi.eof() ; zi++)
               {
                   if (zi == "]]>")
                       { zi += 3; break ; }
                   pCN->m_tmpContent.AddByte(*zi) ;
               }
               continue ;
           }
           if (zi == "<noscript")
           {
               for (zi += 9; !zi.eof() ; zi++)
               {
                   if (zi == "</noscript>")
                       { zi += 11;break ; }
               }
               if (zi.eof())
                   { threadLog("Unclosed <noscript> block\n") ; rc = E_FORMAT ; break ; }
               continue ;
           }
           wholetag.Clear() ;
           tagword.Clear() ;
           limit = zi ;
           limit++ ;
           W.AddByte(CHAR_LESS) ;
           bAnti = false ;
           if (*limit == CHAR_FWSLASH)
               { W.AddByte(CHAR_FWSLASH) ; bAnti = true ; limit++ ; }
           nColon = 0;
           for (tw_start = limit ; !limit.eof() ; limit++)
           {
               if (*limit == CHAR_COLON || IsAlphanum(*limit))
               {
                   if (*limit == CHAR_COLON)
                       nColon++ ;
                   T.AddByte(*limit) ;
                   W.AddByte(*limit) ;
                   continue ;
               }
               break ;
           }
           tagword = T ;
           T.Clear() ;
           for (; !limit.eof() ;)
           {
               W.AddByte(*limit) ;
               if (*limit == CHAR_DQUOTE || *limit == CHAR_SQUOTE)
               {
                   cDelim = *limit ;
                   for (limit++ ; !limit.eof() ; limit++)
                   {
                       if (*limit == CHAR_BKSLASH)
                       {
                           limit++ ;
                           if (*limit == cDelim)
                               continue ;
                       }
                       if (*limit == cDelim)
                           break ;
                   }
               }
               if (*limit == CHAR_MORE)
                   break ;
               limit++ ;
           }
           wholetag = W ;
           W.Clear() ;
           if (*limit != CHAR_MORE)
           {
               threadLog("Malformed tag (%s)\n", *wholetag) ;
               zi = limit ;
               continue ;
           }
           limit++ ;
           if (nColon)
           {
               if (!s_htagNam.Exists(tagword))
               {
                   tf.klas = HTCLASS_3RD ;
                   tf.rule = HTRULE_OPTION ;
                   tf.name = tagword ;
                   s_htagTyp.Insert(tf.type, tf) ;
                   s_htagNam.Insert(tf.name, tf) ;
                   threadLog("Inserted 3rd party HTML tag %s\n", *tagword) ;
               }
           }
           if (!s_htagNam.Exists(tagword))
           {
               if (bAnti)
                   threadLog("Line %d case 1 Unknown lookup anti-tag </%s> (%s)\n", zi.Line(), *tagword, *wholetag) ;
               else
                   threadLog("Line %d Case 1 Unknown lookup tag <%s> (%d bytes)\n", zi.Line(), *tagword, wholetag.Length()) ;
               pCN->m_tmpContent << wholetag ;
               zi = limit ;
               continue ;
           }
           tf = s_htagNam[tagword] ;
           if (tf.type == HTAG_NULL)
           {
               if (bAnti)
                   threadLog("Line %d case 2 Unknown lookup anti-tag </%s> (%s)\n", zi.Line(), *tagword, *wholetag) ;
               else
                   threadLog("Line %d Case 2 Unknown lookup tag <%s> (%d bytes)\n", zi.Line(), *tagword, wholetag.Length()) ;
               pCN->m_tmpContent << wholetag ;
               zi = limit ;
               continue ;
           }
           if (bAnti == false)
           {
               if (zi.Equiv("<title>"))
               {
                   pCN = _proctag(m_pHead, zi, HTAG_TITLE) ;
                   if (!pCN)
                       { rc = E_FORMAT ; threadLog("Line %d Could not process <meta> tags\n", zi.Line()) ; }
               }
               else if (zi.Equiv("<meta"))
               {
                   pCN = _proctag(m_pHead, zi, HTAG_META) ;
                   if (!pCN)
                       { rc = E_FORMAT ; threadLog("Line %d Could not process <meta> tags\n", zi.Line()) ; }
               }
               else if (zi.Equiv("<style"))
               {
                   pCN = _proctag(m_pHead, zi, HTAG_STYLE) ;
                   if (!pCN)
                       { rc = E_FORMAT ; threadLog("Line %d Could not process <style> tags\n", zi.Line()) ; }
               }
               else if (zi.Equiv("<script"))
               {
                   pCN = _proctag(m_pHead, zi, HTAG_SCRIPT) ;
                   if (!pCN)
                       { rc = E_FORMAT ; threadLog("Line %d Could not process <script> tags\n", zi.Line()) ; }
               }
               else if (zi.Equiv("<link"))
               {
                   pCN = _proctag(m_pHead, zi, HTAG_LINK) ;
                   if (!pCN)
                       { rc = E_FORMAT ; threadLog("Line %d Could not process <link> tags\n", zi.Line()) ; }
               }
               else if (zi.Equiv("<base"))
               {
                   pCN = _proctag(m_pHead, zi, HTAG_BASE) ;
                   if (!pCN)
                       { rc = E_FORMAT ; threadLog("Line %d Could not process <link> tags\n", zi.Line()) ; }
                   if (pCN->m_tmpContent.Size())
                       m_Base = pCN->m_tmpContent ;
                   else
                   {
                       ai = pCN ;
                       if (ai.Value())
                           m_Base = ai.Value() ;
                   }
               }
               else
                   { rc = E_FORMAT ; threadLog("Line %d Could not process <%s> tag within <head>\n", zi.Line(), *tagword) ; }
               continue ;
           }
           if (bAnti)
           {
               if (zi.Equiv("</head>"))
                   { zi += 7; break ; }
               if (tf.klas == HTCLASS_TXT)
                   { pCN->m_tmpContent << wholetag ; zi = limit ; continue ; }
               zi = limit ;
               if (pCN->Type() == tf.type || tf.rule == HTRULE_SINGLE)
                   pCN = pCN->Parent() ;
               else
               {
                   threadLog("case 1 Tag mis-match. Current highest tag is <%s id=%d, level=%d> but on line %d we have an anti-tag for %s\n",
                       *Tagtype2Txt(pCN->Type()), pCN->GetUid(), pCN->Level(), zi.Line(), *Tagtype2Txt(tf.type)) ;
                   if (tf.rule == HTRULE_SINGLE)
                   {
                       pCN = pCN->Parent() ;
                       threadLog("Case 2 Corrected by allowing last tag as anti-tag\n") ;
                   }
                   if (pCN->Type() == HTAG_TBL_CEL && tf.type == HTAG_TR)
                   {
                       for (pX = pCN ; pX ; pX = pX->Parent())
                       {
                           if (pX->Type() == tf.type)
                           {
                               pCN = pX ;
                               threadLog("Corrected by decending to level %d\n", pCN->Level()) ;
                               break ;
                           }
                       }
                   }
               }
               continue ;
           }
           zi++ ;
       }
       for (; !zi.eof() ;)
       {
           if (zi.Equiv("<body"))
           {
               m_pBody = _proctag(m_pRoot, zi, HTAG_BODY) ;
               if (!m_pBody)
                   { threadLog("Expected an actual body\n") ; return E_FORMAT ; }
               break ;
           }
           zi++ ;
       }
       if (!m_pBody)
           { threadLog("Expected a <body> tag\n") ; return E_FORMAT ; }
       pCN = m_pBody ;
   }
   for (; pCN && !zi.eof() ;)
   {
       if (*zi != CHAR_LESS)
       {
           if (pCN->Type() != HTAG_ANCHOR)
           {
               if (*zi <&eq; CHAR_SPACE && pCN->m_tmpContent.Size() == 0)
                   { zi++ ; continue ; }
               pCN->m_tmpContent.AddByte(*zi) ;
           }
           else
           {
               if (pCN->Parent())
                   pCN->Parent()->m_tmpContent.AddByte(*zi) ;
           }
           zi++ ;
           continue ;
       }
       nLine = zi.Line() ;
       if (zi == "<strike>")
       {
           for (zi += 8; !zi.eof() ; zi++)
           {
               if (zi == "</strike>")
                   { zi += 9; break ; }
           }
           if (zi.eof())
               { threadLog("Unclosed comment block\n") ; rc = E_FORMAT ; break ; }
           continue ;
       }
       if (zi == "<fb:like>")
       {
           for (zi += 9; !zi.eof() ; zi++)
           {
               if (zi == "</fb:like>")
                   { zi += 10;break ; }
           }
           if (zi.eof())
               { threadLog("Facebook special\n") ; rc = E_FORMAT ; break ; }
           continue ;
       }
       if (zi == "<g:plusone>")
       {
           for (zi += 11;!zi.eof() ; zi++)
           {
               if (zi == "</g:plusone>")
                   { zi += 12;break ; }
           }
           if (zi.eof())
               { threadLog("Google special\n") ; rc = E_FORMAT ; break ; }
           continue ;
       }
       if (zi == "<!--[if")
       {
           for (zi += 7; !zi.eof() ; zi++)
           {
               if (zi == "<![endif]>")     { zi += 10;break ; }
               if (zi == "<![endif]-->")   { zi += 12;break ; }
           }
           if (zi.eof())
               { threadLog("Unterminated <!--[if cond]..> tag starting line %d\n", nLine) ; rc = E_FORMAT ; break ; }
           continue ;
       }
       if (zi == "<![if")
       {
           for (zi += 5; !zi.eof() ; zi++)
           {
               if (zi == "<![endif]>")     { zi += 10;break ; }
               if (zi == "<![endif]-->")   { zi += 12;break ; }
           }
           if (zi.eof())
               { threadLog("Unterminated <![if cond]..> tag starting line %d\n", nLine) ; rc = E_FORMAT ; break ; }
           continue ;
       }
       if (zi == "<!--")
       {
           for (zi += 4; !zi.eof() ; zi++)
           {
               if (zi == "-->")
                   { zi += 3; break ; }
           }
           if (zi.eof())
               { threadLog("Unterminated <!--> tag starting line %d\n", nLine) ; rc = E_FORMAT ; break ; }
           continue ;
       }
       /*
       **  ** At this point we have the '<' start of tag char. Establish whole and tagword of possible HTML tag
       **           */
       wholetag.Clear() ;
       tagword.Clear() ;
       limit = zi ;
       limit++ ;
       W.AddByte(CHAR_LESS) ;
       bAnti = false ;
       if (*limit == CHAR_FWSLASH)
           { W.AddByte(CHAR_FWSLASH) ; bAnti = true ; limit++ ; }
       nColon = 0;
       for (tw_start = limit ; !limit.eof() ; limit++)
       {
           if (*limit == CHAR_COLON || IsAlphanum(*limit))
           {
               if (*limit == CHAR_COLON)
                   nColon++ ;
               T.AddByte(*limit) ;
               W.AddByte(*limit) ;
               continue ;
           }
           break ;
       }
       tagword = T ;
       T.Clear() ;
       for (; !limit.eof() ;)
       {
           W.AddByte(*limit) ;
           if (*limit == CHAR_DQUOTE || *limit == CHAR_SQUOTE)
           {
               cDelim = *limit ;
               for (limit++ ; !limit.eof() ; limit++)
               {
                   if (*limit == CHAR_BKSLASH)
                   {
                       limit++ ;
                       if (*limit == cDelim)
                           continue ;
                   }
                   if (*limit == cDelim)
                       break ;
               }
           }
           if (*limit == CHAR_MORE)
               break ;
           limit++ ;
       }
       wholetag = W ;
       W.Clear() ;
       if (*limit != CHAR_MORE)
       {
           threadLog("Malformed tag (%s)\n", *wholetag) ;
           zi = limit ;
           continue ;
       }
       tagword.ToLower() ;
       if (nColon)
       {
           if (!s_htagNam.Exists(tagword))
           {
               tf.klas=HTCLASS_3RD ;
               tf.rule=HTRULE_OPTION ;
               tf.name = tagword ;
               s_htagTyp.Insert(tf.type, tf) ;
               s_htagNam.Insert(tf.name, tf) ;
               threadLog("Inserted 3rd party HTML tag %s\n", *tagword) ;
           }
       }
       tf = s_htagNam[tagword] ;
       if (tf.type == HTAG_NULL)
       {
           if (bAnti)
               threadLog("Line %d Unknown lookup anti-tag </%s> (%s)\n", zi.Line(), *tagword, *wholetag) ;
           else
               threadLog("Line %d Case 3 Unknown lookup tag <%s> (%d bytes)\n", zi.Line(), *tagword, wholetag.Length()) ;
           pCN->m_tmpContent << wholetag ;
           zi = limit ;
           continue ;
       }
       if (bAnti == false)
       {
           if (tf.klas == HTCLASS_IMG)
               { zi = limit ; continue ; }
           if (tf.klas == HTCLASS_SYS)
           {
               if (tf.type == HTAG_EMBED)
                   pCN->m_tmpContent << "<embed/>" ;
               if (tf.type == HTAG_NOEMBED)
                   pCN->m_tmpContent << "<noembed/>" ;
               for (; !zi.eof() ; zi++)
               {
                   if (*zi == CHAR_MORE)
                       { zi++ ; break ; }
               }
               threadLog("Line %d Bypassed system tag <%s> (%s)\n", zi.Line(), *tagword, *wholetag) ;
               zi = limit ;
               continue ;
           }
           if (tf.klas == HTCLASS_TXT) //  || tf.type == HTAG_ANCHOR)
           {
               pCN->m_tmpContent << wholetag ; zi = limit ;
               continue ;
           }
           if (zi.Equiv("<script"))
           {
               for (tmp = zi ; !tmp.eof() ; tmp++)
               {
                   if (tmp.Equiv("</script>"))
                       { tmp += 9; zi = tmp ; break ; }
               }
               if (zi.eof())
                   { threadLog("Unclosed script tag\n") ; rc = E_FORMAT ; break ; }
               continue ;
           }
           /*
           **  ** Process 'data structure' tags into nodes. These are tables (with there rows and columns) but also menus
           **     ** and ordered and unordered lists.
           **                */
           pNN = 0;
           pNN = _proctag(pCN, zi, tf.type) ;
           if (!pNN)
           {
               threadLog("No node allocated for tag <%s>\n", *Tagtype2Txt(tf.type)) ;
               return E_FORMAT ;
           }
           pCN = pNN ;
           zi = limit ;
           /*
           **  ** Handle the <input> tag. As this is it's own anti-tag it has no content, only parameters. We need to include the tag
           **     ** in the tree as it is active, but we need to effect the anti-tag aspect as well (so the level is not raised)
           **                */
           if (tf.type == HTAG_INPUT)
               pCN = pCN->Parent() ;
           continue ;
       }
       if (bAnti)
       {
           if (tf.klas == HTCLASS_TXT) //  || tf.type == HTAG_ANCHOR)
               { pCN->m_tmpContent << wholetag ; zi = limit ; continue ; }
           if (tf.klas == HTCLASS_SYS)
           {
               if (tf.type == HTAG_EMBED)
                   pCN->m_tmpContent << "</embed>" ;
               if (tf.type == HTAG_NOEMBED)
                   pCN->m_tmpContent << "</noembed>" ;
               for (; !zi.eof() ; zi++)
               {
                   if (*zi == CHAR_MORE)
                       { zi++ ; break ; }
               }
               threadLog("Line %d Bypassed system anti-tag <%s> (%s)\n", zi.Line(), *tagword, *wholetag) ;
               zi = limit ;
               continue ;
           }
           zi = limit ;
           if (pCN->Type() == tf.type || tf.rule == HTRULE_SINGLE)
               pCN = pCN->Parent() ;
           else
           {
               threadLog("case 2 Tag mis-match. Current highest tag is <%s id=%d, level=%d> but on line %d we have an anti-tag for %s\n",
                   *Tagtype2Txt(pCN->Type()), pCN->GetUid(), pCN->Level(), zi.Line(), *Tagtype2Txt(tf.type)) ;
               if (tf.rule == HTRULE_SINGLE)
               {
                   pCN = pCN->Parent() ;
                   threadLog("Case 1 Corrected by allowing last tag as anti-tag\n") ;
               }
               if (pCN->Type() == HTAG_TBL_CEL && tf.type == HTAG_TR)
               {
                   for (pX = pCN ; pX ; pX = pX->Parent())
                   {
                       if (pX->Type() == tf.type)
                       {
                           pCN = pX ;
                           threadLog("Corrected by decending to level %d\n", pCN->Level()) ;
                           break ;
                       }
                   }
               }
           }
           continue ;
       }
       threadLog("HANDLING ABD %s (%s)\n", *tagword, *wholetag) ;
   }
   if (pCN)
       threadLog("End of file encountered whilst inside tag definition\n") ;
   for (nX = 0; nX < m_vecTags.Count() ; nX++)
   {
       pX = m_vecTags[nX] ;
       if (pX->Type() == HTAG_FORM)
       {
           pCurForm = pX ;
           pForm = new hzHtmForm() ;
           m_Forms.Add(pForm) ;
           continue ;
       }
       if (pCurForm)
       {
           if (pX->Type() == HTAG_INPUT)
           {
               if (pX->Line() < pCurForm->Anti())
               {
                   P.name = pX->Name() ;
                   for (ai = pX ; ai.Valid() ; ai.Advance())
                   {
                       anam = ai.Name() ; aval = ai.Value() ;
                       if (anam == "value")
                           { P.value = aval ; break ; }
                   }
                   pForm->fields.Add(P) ;
               }
               continue ;
           }
           if (pX->Line() > pCurForm->Anti())
               pCurForm = 0;
       }
   }
   threadLog("END OF LOAD page has %d links\n", m_vecLinks.Count()) ;
   return rc ;
}