accessing a <tecnique profile> child

I’m reading a DAE file and want to access an <int_array> tag who’s the child of a <tecnique_profile> tag.

for clarity the dae file look like that

<extra>
<technique_profile =“slice”>
<int_array count = “24”> …values …</int_array>
</technique>
</extra>

To access that array I do this (without success) . Tek variable is good (tested with debugger)


domTechniqueRef tek;
string prof =  (string)tek->getProfile() ;
if(prof.find("slice")!=string::npos)
{
   vector<int> tmp;
   
   // Loop over <int_array> 
   for(unsigned int j=0;j<tek->getContents().getCount();j++)	  
   {
      tmp.push_back(tek->getContents().get(j));  <== give me an error	        
   }
}

I have a pointer on the technique profile , and I want to access the int_array how can I do ? Maybe i’m not using correctly tek->getContents() ??

Yes, you’re using getContents slightly wrong. getContents returns an array containing the child elements of the technique. So in your example, it’ll have one element containing a domInt_array object, and then you can use that object to get the actual array of ints.

This code should work:

domInt_array* intArrayElement = daeSafeCast<domInt_array>(tek->getContents()[0]);
domListOfInts& array = intArrayElement->getValue();

Steve