Talk:DOM guide: Working with elements

From COLLADA Public Wiki
Revision as of 02:55, 12 April 2007 by Elf (talk | contribs) (Terminology questions: fix link for divided page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Belonging to a document

Andy, you said: "If the element belongs to a document"--how do you know if it does? By using getDocumentURI? The preceding paragraph seems to imply that you will always get a result using get..URI; but this sentence seems to imply that sometimes it won't. When would it not belong to a document and what would get..URI do in that case? Elf 11:02, 23 March 2007 (PDT)

The complete sentence is "If the element belongs to a document then it is safe to assume that the element is a domCOLLADA element.":

  • This sentence is in the paragraph discussing parent elements, and it's not clear how this info is related to the parent.
  • What is a domCOLLADA element and why is it important to know whether you can assume it?

Elf 11:16, 23 March 2007 (PDT)

hmm. Being able do know that the element is a domCOLLADA isn't really important. The domCOLLADA element is the root of a COLLADA Document. So root nodes have no parents, hence the being able to assume so. It is possible to create element trees that aren't part of a document and aren't inserted in the database. I don't know of anyone who does that but it is possible. In that case though the root node of the tree is not necessarily a domCOLLADA it could be any element.
Calling getDocument or getDocumentURI would work as a test if it is in a document or not. A return value of NULL would mean it isn't in a document.
Alorino 11:34, 23 March 2007 (PDT)

OK, I've rewritten the paragraph. Please check my work. (use article's history tab). Elf 12:41, 27 March 2007 (PDT)

That looks good. Thanks.Alorino 13:48, 27 March 2007 (PDT)

Terminology questions

  • Is "COLLADA Object Model" the same as "COLLADA DOM"?
  • Is "Reflective Object System" a component of COLLADA, or of COLLADA DOM?

Elf 11:08, 23 March 2007 (PDT)

  1. COLLADA DOM is the whole API. The COLLADA Object Model is the element tree, essentially all of the dom* classes. Its what is talked about in the DOM guide: Representing elements in the object model and DOM guide: Working with elements (originally was: DOM Guide: Object Model pages.
  2. Its part of the COLLADA DOM
  3. Yes. I think Reflective Object Model and Reflective Object System can be used interchangably. In the existing programming guide it was called ROS. In my notes I might have called it ROM. I think I prefer ROS.

Alorino 11:34, 23 March 2007 (PDT)

Names

For this: "The element name is the XML tag that would be present in..." is that "The element name is the value of the "name" XML attribute that would be present in..."? Also--if the name attributae is for some reason explicitly set to the same as the type name, would getElementName still return NULL? Elf 13:05, 23 March 2007 (PDT)

Ellen: No, the name attribute has nothing to do with elementName. The Element name would be the <tag> in the document. The best example of this would be the xfov, yfov, aspect_ratio elements from <camera> in the COLLADA schema. The schema looks like <xs:element name="xfov" type="targetableFloat"/>. In an instance document you would see the element <xfov> but in the DOM you would see a domTargetableFloat with getElementName returning "xfov" and getTypeName returning "targetableFloat".
Looking at what I just wrote I am unsure of what name attribute you are refering to now. Are you talking about the name attribute in the COLLADA schema, <xs:element name="blah"> or are you talking about the name attribute found on some COLLADA elements, <geometry id="blah" name="blah">?
If you are talking about the first then I don't think the documentation should get that detailed into the COLLADA Schema. If you are talking about the second then what I said earlier applies.
The name being the same as the typename happens to be the case for most COLLADA elements because in the schema they are defined with anonymous types, <xs:element name="blah"><xs:complexType><xs:sequence>... In that case the COLLADA DOM creates a class domBlah and elementName would be NULL because the tag in the COLLADA document would be <blah>. In the case with the xfov and targetableFloat it is different.
Alorino 13:45, 27 March 2007 (PDT)

Hm, OK, looks like the thing to do is to include some examples like these to clarify. I'll do that. Elf 14:05, 27 March 2007 (PDT)