TagList XML::Create(String &source){ TagList tag_list; Tag tag; //タブを半角スペースに置換 source.Replace("\t"," "); //先頭の空白を除去 source.FrontStrip(' '); String data = ""; //先頭から読み込む for(int i = 0 ; i <(signed)source.size() ; i++){ switch(source.at(i)){ case '<': if(data != ""){ tag.setText(data); tag_list.push_back(tag); tag.clear(); data = ""; } continue; case '>': //タグの終了 if(data != ""){ this->setTag(tag,data); tag_list.push_back(tag); tag.clear(); data = ""; } continue; default: data += source.at(i); break; } } return tag_list; }
Tag& link(string fname) { link_tag.clear(); link_tag.add_attrib("HREF",fname); return link_tag; }