element min and max occur


when I read COLLADA schema (1.5) the triangles element can occur (not defined, so it goes default) one and only one time, but there is a comment that says it can occur 0-* times. Well, normally I’d take the defined schema as a reference but in the collada specification triangles can occur 0-* times and I’m confused. :shock: :wink:


Where abouts exactly in the schema does it say it ‘goes default’?

As far as i can see the <triangles> element can have one of two parents, <mesh> and <convex_mesh>.

I can’t see where on the specification pages for either of those elements that it mentions that triangles is default.

If you could elaborate on this I’d be grateful as I’m currently implementing my own Collada file reader/translator from scratch and I’m trying not to miss anything like this out. :o)


Well, there is no “goes default” it’s just my interpretation :slight_smile: I’m not sure if it’s correct, but as I remember when you don’t specify min and max attributes in your element definition the default value is 1 for both attributes? Xmlspy says so also.

Ok, here’s what I’m thinking.

I’ve looked at the documentation, and it specifies that triangles can appear within both <convex_mesh> and <mesh> zero to unbounded (0 - *) number of times.

It states in the schema file (found here: http://www.khronos.org/files/collada_schema_1_5) that…

<xs:choice minOccurs="0" maxOccurs="unbounded">

… appears as a parent to…

<xs:element name="triangles" type="triangles_type">

… for both <mesh> and <complex_mesh>.

Which leaves me thinking that you’re questioning that the <xs:element> type in the schema. In this case, I’m out, as I’m not an XML pro. Hopefully one of the pro’s will sign in and help you with your problem.

All the best,

<xs:choice minOccurs=“0” maxOccurs=“unbounded”>

I think that’s the answer to my doubts. Propably the <triangles> take this as it’s own. I didn’t know that. I think I can thank you right now for the explanation, but if the person you’ve mentioned still wants to help it would be nice. I’m sure there’ll be more questions :wink:

Yes that’s right. The choice of primitives (e.g. <triangles>) can occur 0 or more times. The schema enables the <mesh> to contain any combination of triangles, polygons, etc…