TinyXML GetText()

Started by
14 comments, last by mattd 14 years, 5 months ago
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.

DirectX 11, C++

Advertisement
Using TiXmlElement::GetText?

I don't think that should be limiting the text returned - what does your code look like that calls this method?

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]

DirectX 11, C++

What are the types of POLYGONS and P?

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

GetText() return right data .. but not all.

DirectX 11, C++

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?
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?
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.

DirectX 11, C++

Can you post the exact code that doesn't work, when you try to dynamically allocate INDICES_DATA?
ftp://78.102.70.147/problem.png

image is better :)

DirectX 11, C++

This topic is closed to new replies.

Advertisement