Loading a dae file in D3D10

Hy.
I’m trying to read a simple teapot, here is the code.
http://rafb.net/p/90vH0Z49.html

I’m trying to load it in D3D10, and so i need vertices. I wrote this code yesterday and i’m still working on it, but really i do not know how to get it work.
In this case, i want to get only first 3 semantics (Vertices,Normals and Texcoord), and SEM_NUM = 3.
Here is the code


		domGeometry *Geometry;
		domMesh *Mesh;
		domTriangles *triangles;

		collada_dom->getDatabase()->getElement((daeElement**)&Geometry,0,0,COLLADA_TYPE_GEOMETRY,0);
		Mesh = Geometry->getMesh();
		triangles = Mesh->getTriangles_array().get(0);
		int SemNum = triangles->getInput_array().getCount();
//Vertex declaration creation not shown here
		int sz = triangles->getP()->getValue().getCount();
		domUint *Index = new domUint[sz];

{
			domListOfUInts IndexArray = triangles->getP()->getValue();
		for (int i = 0;i < sz ;i++)
		{
			Index[i] = IndexArray.get(i);
		}
	}

	domListOfFloats Vertx,Texs,Norm;
		for (int i = 0; i < SEM_NUM; i++)
		{
			for (unsigned int z = 0; z < Mesh->getSource_array().getCount();z++)
			{
				if (strcmp(Mesh->getVertices()->getId(),triangles->getInput_array().get(i)->getSource().getID()) == 0)
				{
					if (_stricmp(triangles->getInput_array().get(i)->getSemantic(),"VERTEX") == 0)
					{
						Vertx = Mesh->getSource_array().get(z)->getFloat_array()->getValue(); //Coordinate di texture!
						break;
					}
				}
				
				if (strcmp(Mesh->getSource_array().get(z)->getID(),triangles->getInput_array().get(i)->getSource().getID()) == 0)
				{
					if (_stricmp(triangles->getInput_array().get(i)->getSemantic(),"TEXCOORD") == 0)
					{
						Texs = Mesh->getSource_array().get(z)->getFloat_array()->getValue(); //Coordinate di texture!
						break;
					}

					if (_stricmp(triangles->getInput_array().get(i)->getSemantic(),"NORMAL") == 0)
					{
						Norm = Mesh->getSource_array().get(z)->getFloat_array()->getValue(); //Normali!
						break;
					}

				} //if
			} //for 2
		} //for 1

		unsigned int bufsize = Vertx.getCount() + Texs.getCount() + Norm.getCount();

				
		for (int i = 0,t = 0,f = 0; f < Vertx.getCount() / 3; f++,i+=9,t+=15)
	{
		buffer[i] = Vertx.get(Index[t]);
		buffer[i+1] = Vertx.get(Index[t+1]);
		buffer[i+2] = Vertx.get(Index[t+2]);
		
	}

fclose(fil);

	for (int i = 3,t = 3,f=0; f < Norm.getCount() / 3;i+=9,t+=15,f++)
	{
		buffer[i] = Norm.get(Index[t]);
		buffer[i+1] = Norm.get(Index[t+1]);
		buffer[i+2] = Norm.get(Index[t+2]);
	}

	for (int i = 7,t = 7,f=0; f < Texs.getCount() / 3;i+=9,t+=15,f++)
	{
		buffer[i] = Texs.get(Index[t]);
		buffer[i+1] = Texs.get(Index[t+1]);
		buffer[i+2] = Texs.get(Index[t+2]);
	}


It does not work: vertices are taken but in wrong way and the Normal reading crashes (The indices reaches 183 while Count() is 180).
Can you give me some suggestions??