Difference between revisions of "Talk:DOM guide: Working with documents/old version"

From COLLADA Public Wiki
Jump to navigation Jump to search
m (fix catg sort)
Line 1: Line 1:
After  you have loaded a [[COLLADA instance document]], or before saving one, it is represented in the [[DOM runtime database]]. You can manipulate the DOM representation of documents in the database using the '''daeDatabase''' object.
{{delete | reason=Content subsumed by another page.}}
==Querying Documents==
Three functions allow you to query for and iterate over documents in the runtime database:
* <code>daeDatabase::getDocumentCount</code>
* <code>daeDatabase::getDocument</code>
* <code>daeDatabase::isDocumentLoaded</code>
The following function removes a document from the runtime database. Removing a document removes the root element and subsequently the entire element heirarchy from the database:
* <code>daeDatabase::removeDocument</code>
==Creating New Documents==
You can use the COLLADA DOM to create a set of elements, add them to an empty database, and write the database to a [[COLLADA instance document]]. To do this, you need to ensure that you have a database created for use. When calling '''DAE::load''' or '''DAE::saveAs''', the COLLADA DOM creates the default database and backend to use for those operations. If you start by creating data from scratch then you must ensure that there is a backend and a database created for use. To create and use the default database and backend, call
Each document in the COLLADA DOM requres a '''domCOLLADA''' element as the root element for the document. These functions  create a '''domCOLLADA''' root element automatically:
* '''daeDatabase::insertDocument(daeString, daeDocument**)'''
* '''daeDatabase::createDocument(daeString, daeDocument**)'''
These functions allow you to pass in an existing domCOLLADA element to be used for the document root:
*'''daeDatabase::insertDocument(daeString, daeElement*, daeDocument**)'''
*'''daeDatabase::createDocument(daeString, daeElement*, daeDocument**)'''
These functions  create a '''daeDocument''' and insert it into the database. The document created is returned in the last argument:
* '''daeDatabase::insertDocument(daeString, daeDocument**)'''
* '''daeDatabase::insertDocument(daeString, daeElement*, daeDocument**)'''
The '''daeDatabase::createDocument''' functions allow you to create a new COLLADA document without inserting it into the database. You can later call '''daeDatabase::insertDocument( daeDocument *c )''' to insert the document into the database.
{{DOM tutorial}}
[[Category:DOM tutorial|Working with documents]]

Revision as of 06:19, 21 May 2007

Sysop, please delete this page. Reason: Content subsumed by another page.