hierarchical rotations of nodes

Hello,
I have implemented a viewer opengl that can parse and render a file with the collada format. I have a nasty bug in my viewer: it seems that the rotations are not implemented correctly. Here is what I do:

  • I store all the rotations for each instance inside a stl vector ( taking into
    account the hierarchy of nodes, i.e. the first rotation in the stl vector corresponds to
    the first rotation met in the nodes hierarchy)
  • Then, I take each rotations one after the other, transform it into a quaternion and
    multiply it by the quaternion obtained from the previous multiplication.

Here follows a simple example:

for the following lines:
<scene id=“hotel_circus.max” name=“hotel_circus.max”>
<node id=“hotel” name=“hotel”>
<translate>149.743 -86.4957 56.66 </translate>
<rotate>0 0 -1 -90</rotate>
<node id=“Obst_pilliers” name=“Obst_pilliers”>
<translate>3.72179 38.3972 -40.7832 </translate>
<rotate>0 0 1 -180</rotate>
<instance url="#Obst_pilliers-obj"></instance>
</node>

The instance “Obst_pilliers” has first a rotation of -90 degrees and then a rotation of -180 degrees around z axis.
I ttransform the axis angle rotations into quaternions and multiply the first one by the second one.
Once I have the resulting quaternion, I transform it into a 4x4 matrix that I multiply to the object matrix.
Is this approach wrong? How should multiple hierarchical rotations be applied to an object? Thanks for helping me!