tinyxml 수정사항

database 2010. 1. 15. 10:40

//string이 0으로 초기화 되면 오류가 발생
const char* TiXmlElement::GetText() const
{
  static char szEmpty[1] = "";
 const TiXmlNode* child = this->FirstChild();
 if ( child ) {
  const TiXmlText* childText = child->ToText();
  if ( childText ) {
   return childText->Value();
  }
 }
 return szEmpty;
 //return 0;
}

//set text기능이 없는거 같아 추가
void TiXmlElement::SetText(const char * _value) 

 //Text Type을 찾음
 TiXmlNode* pnd = NULL;
 TiXmlText* ptiText = NULL;
 for( pnd = this->FirstChild();
   pnd;
   pnd = pnd->NextSibling() )
 {
  if (pnd->Type() == TEXT)
  {
   ptiText = (TiXmlText*)pnd->ToText();
   break;
  }
 }

    if ( ptiText != NULL ) { 
  ptiText->SetValue(_value);
 }
 else
 {
  TiXmlElement* pel = NULL;

  TiXmlText tiTxt(_value);
  pel = this->FirstChildElement();
  if (pel != NULL)
  {
   this->InsertBeforeChild(pel, tiTxt);
  }
  else
  {   
   this->InsertEndChild(tiTxt);
  }
 }  
}

'database' 카테고리의 다른 글

T-SQL과 ANSI SQL JOIN방식 차이  (0) 2014.06.03
varchar냐 date냐  (1) 2011.08.19
오라클과 MSSQL 함수 비교  (0) 2010.06.18
DBMS에 따른 날짜포맷 변환  (0) 2010.06.18
블로그 이미지

란마12

,