TinyXML and std::vector

T

thomas.frendo

Hi,

I'm trying to store some elements of TinyXml in a 2d std::vector

here is my code


#include "stdafx.h"
#include "tinyxml.h"
#include <vector>

void write_simple( )
{

TiXmlDocument doc;
TiXmlDeclaration * decl = new TiXmlDeclaration( "1.0", "", "" );
doc.LinkEndChild( decl );

std::vector<std::vector<TiXmlElement*>> element;
element.push_back(std::vector<TiXmlElement*>(2));
element[0].push_back( new TiXmlElement( "Objet1" ));
/*TiXmlElement * param1 = new TiXmlElement( "Param1" );
element[0].push_back(param1);
element[0][0]->LinkEndChild( element[0][1]);*/

doc.LinkEndChild( element[0][0] );



doc.SaveFile( "madeByHand3.xml" );
}

int main(int argc, char* argv[])
{

write_simple();
return 0;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,166
Latest member
DollyBff32
Top