How to read value of <init_from>

Hi,

I have reading the value of the element <init_from> using this code snippet:

domFx_surface_commonRef surface;
//Surface initialized here...
const domFx_surface_init_commonRef surfaceInit = surface->getFx_surface_init_common();
if (surfaceInit)
{
	const daeElementRefArray& initContent = surfaceInit->getContents();
	for (Uint32 index=0; index < initContent.getCount(); ++index)
	{
		daeElement* element = initContent[index];
               //element has been verified non-null
		if (element->hasCharData())
		{
			const char* data = element->getCharData().c_str();
                       ...
		}
	}
}

This code keeps throwing an access violation on call to getCharData(). Please advise.

Thanks,

OK, I found the answer to my own question.

Instead of calling getContents(), I should have called getInit_from_array(). So the code that will give me the texture file name will look like this:


domFx_surface_commonRef surface;
//Surface initialized here...
const domFx_surface_init_commonRef surfaceInit = surface->getFx_surface_init_common();
if (surfaceInit)
{    
    const domFx_surface_init_from_common_Array& initFromList = surfaceInit->getInit_from_array();
    for (Uint32 initFrom=0; initFrom < initFromList.getCount(); ++initFrom){
        domImage* image = daeSafeCast<domImage>(InitFromList[initFrom]->getValue().getElement(););cout<<image->getInit_from()->getValue().getOriginalURI(<<endl;
    }
}

Thanks