0

Tiny XML has been great so far but I'm having what I feel like is a really basic problem but it's been stumping me pretty bad... What I need to do is just take input from Cin and put it into the TiXmlElement and TiXmlText classes. I can't seem to get it so that I can take in something in a reasonable format that will also preserve any spaces I have. I want to be able to input things like "Tem Village" or a small paragraph of text between my tags, and it's only reading in the first element. I've tried doing things like this:

std::cout << "We're taking input now." << std::endl;
std::string toTake;
std::cin >> toTake;

TiXmlElement * element2 = new TiXmlElement(toTake);
variables.LinkEndChild(element2);
variables.SaveFile();`

Tried running the TiXmlBase::SetCondenseWhiteSpace(false); method with no results.. Please help! This is very important to what I'm working on and any help would be greatly apprecaited!

What I want is an XML document that will look like this:

<Tag>Hoi I'm Tem</tag>

Just as an example... But everytime I enter something like that into my Char * (which is the input TinyXML takes, I get this:

<Tag>Hoi</tag>

Anyone think they can help?

-Terra

Terra
  • 1

1 Answers1

0

I'm an idiot I got it! Just needed to not use cin... A quick GetLine() solved all my issues.

Terra
  • 1