So, I wen on another path.
Now, I have a special word that compiles a word with a data structure where I have ALL elements data (their address, length and type) and 3 index tables, one for the TAGs, another for TEXT elements and another for ENTITIES.
So, now, if I want to know how many elements I have, I just have to use:
-1 0 MML_ROOT_DATA
and get the address where I have the total number of elements.
If I want to know how many TAGs I have, I just use
1 0 MML_ROOT_DATA
and for the first TAG I use:
1 1 MML_ROOT_DATA, etc.
For text elements, the 1st value is 2 instead of 1 and for ENTITIES is 3.
So, now it's a piece of cake to see if a TAG is a simple TAG or a CONTAINER and to extract their parameters and or contents, in the cae of the containers!