void WriteXml()
{
//형식 선언
TiXmlDocument doc;
TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "euc-kr", "" );
doc.LinkEndChild( decl );
//서브 노드 추가
TiXmlElement * root = new TiXmlElement( "root" );
doc.LinkEndChild( root );
//주석 추가
TiXmlComment * comment = new TiXmlComment();
comment->SetValue( "각국의 대표 음식들이다." );
root->LinkEndChild( comment );
//root의 자식으로 food 서브 노드 추가
TiXmlElement *food = new TiXmlElement( "food" );
root->LinkEndChild( food );
//food의 Attribute로 "num" 추가
food->SetAttribute("num", 1); //food->SetAttribute("num", "1")와 동일
//food의 자식으로 name 서브 노드와 값 추가
TiXmlElement *name = new TiXmlElement( "name" );
food->LinkEndChild( name );
name->LinkEndChild( new TiXmlText( "김치" ));
//food의 자식으로 country 서브 노드와 값 추가
TiXmlElement *country = new TiXmlElement( "country" );
food->LinkEndChild( country );
country->LinkEndChild( new TiXmlText( "대한민국" ));
doc.SaveFile("test_write.xml");
}