Jump to content
  • Advertisement
Sign in to follow this  
wh1sp3rik

TinyXML GetText()

This topic is 3126 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I would like to ask, how to load more data with GetText() ? I am trying to load collada file and it contains 10000+ characters. it loads only first 256 letters. data are between

in <triangles>. Thank you.

Share this post


Link to post
Share on other sites
Advertisement

const char * INDICES_DATA = NULL;

POLYGONS = MESH->FirstChildElement("triangles");

if(POLYGONS)
{
P = POLYGONS->FirstChildElement("p");
INDICES_DATA = P->GetText();
}

INDICES_DATA contains string of numbers. Length of string is really 10000+ .

Thank you for reply


EDIT: it works, when i create array like char INDICES_DATA[50000];
but when i allocate it , it doesn't work, lol, strange

[Edited by - wh1sp3rik on November 4, 2009 6:46:36 AM]

Share this post


Link to post
Share on other sites
What are the types of POLYGONS and P?

Are you sure POLYGONS is non-null, i.e., that GetText is actually being called?

Share this post


Link to post
Share on other sites
Quote:
Original post by wh1sp3rik
EDIT: it works, when i create array like char INDICES_DATA[50000];
but when i allocate it , it doesn't work, lol, strange
What do you mean by "allocate it"? Can we see an example where it does and doesn't work?

Share this post


Link to post
Share on other sites
Have you read the caveat / limitation of GetText? Is all the text you want to retrieve in the <p> element and not delimited by another child element? (although a quick look at the COLLADA spec says it shouldn't be)

How are you determining that the length of the string is 256?

Quote:
EDIT: it works, when i create array like char INDICES_DATA[50000];
but when i allocate it , it doesn't work, lol, strange

I don't follow you here. GetText returns a const char *.. how are you putting it into that array?

Share this post


Link to post
Share on other sites
this works :)
char INDICES_DATA[500000];

int len=0;

POLYGONS = MESH->FirstChildElement("triangles");

if(POLYGONS)

{

P = POLYGONS->FirstChildElement("p");

len = UtilityManager::char_length(P->GetText());
memcpy(INDICES_DATA, P->GetText(), sizeof(char)*len);
}


LEN is 380650, yeah, pretty big collada model :D
by allocate it, i mean
char * INCIDES_DATA;

...

INDICES_DATA = new char[len];

...

this doesn't work, it will save only length about 256 letters.

Share this post


Link to post
Share on other sites
Can you post the exact code that doesn't work, when you try to dynamically allocate INDICES_DATA?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!