Пример #1
0
bool xmlRep::find(strRef tag, xmlElem &elem) {
  strVal temp  = "<"+tag;
  strVal foundTag; 
  strPos start = 0;
  do
  {  
	  start = _xmlStr.find(temp, start?start+temp.size():start);
	  if(start >= _xmlStr.size())
		  return false;
	  strPos end1  = _xmlStr.find(' ',start);
	  strPos end2  = _xmlStr.find('>',start);
	  strPos end   = std::min(end1,end2);
	  if(start > _xmlStr.size() || end > _xmlStr.size())
		  return false;
	  foundTag = _xmlStr.substr(start,end-start);
  }while(temp != foundTag);

  strPos end = findCloseTag(tag);
  if(end > _xmlStr.size())
    return false;
  if(end <= start)
    return false;
  strIter iStart = _xmlStr.begin() + start;
  strIter iEnd   = _xmlStr.begin() + end;
  
  elem.elemStr() = strVal(iStart,iEnd);
  return true;
}
Пример #2
0
bool xmlRep::nextElem(xmlElem &elem) {

  strVal tag;
  strPos start = findNextTag(tag);
  if(start >= _xmlStr.size())
    return false;
  strPos end   = findCloseTag(tag);
  if(end > _xmlStr.size() || end < start)
    return false;
  strIter iStart = _xmlStr.begin() + start;
  strIter iEnd   = _xmlStr.begin() + end;
  strVal temp(iStart,iEnd);
  elem.elemStr() = temp;
  return true;
}
Пример #3
0
bool xmlRep::find(strRef tag, xmlElem &elem) {

  strPos start = _xmlStr.find(tag);
  if(start >= _xmlStr.size())
    return false;
  strPos end = findCloseTag(tag);
  if(end > _xmlStr.size())
    return false;
  if(end <= start)
    return false;
  strIter iStart = _xmlStr.begin() + start - 1;
  strIter iEnd   = _xmlStr.begin() + end;
  strVal temp(iStart,iEnd);
  elem.elemStr() = temp; // /???
  return true;
}