>>myValue= new char[sizeof(textVal)];
That won't work because sizeof(testVal) is nothing more than sizeof(char *), or 4 on most 32-bit compilers. What you want is myValue= new char[strlen(textVal)+1]
then on the next line call strcpy() instead of memcpy().
Those two lines can be combined like this: myValue = strdup(element->GetText());
. To destroy the memory call free() instead of delete[] because strdup() is a C function that uses malloc().