From COLLADA Public Wiki
Revision as of 03:07, 25 May 2007 by Elf (talk | contribs) (move in paragraph from DOM URI class which is going away & move external link)
Jump to navigation Jump to search

COLLADA uses URIs exclusively to reference resources or files. The URIs must be of the correct standard format to work correctly. A common mistake is to use Windows or Linux paths as URIs. This article describes the correct standardized URI and gives examples.

How URIs are used in COLLADA

URIs are used extensively in COLLADA documents to reference other COLLADA elements or external resources, for example, texture files, shader source code, and so on.

URI syntax

A file path needs to be converted to a file scheme URI before being passed to the COLLADA DOM. ((EDITOR: This page needs the following improvement: This also applies to COLLADA, not just the DOM, right? ))

The basic URI file scheme syntax is:


URIs are either absolute or relative:

  • An absolute URI contains a scheme and an authority.
  • A relative URI is any URI that does not contain both a scheme and an authority. A relative URI can be a relative path, an absolute path, or just a fragment.

The fragment portion identifies elements by their COLLADA id attribute. The id attribute references an element that can be found within the same document as the URI. An example of this:


Example of an absolute URI that references a file named document.dae on the localhost found in c:/path; it refers to an element with an id of "Geo_01".


Examples of relative path URIs:


Normalizing relative URIs

A base URI is needed to normalize relative URIs (turn them into absolute URIs). Absolute URIs do not require a separate base URI.

Assuming a base URI of


here are some examples of how URIs would be normalized:

Original URI Normalized URI

Paths versus URIs

Windows paths

A Windows absolute path must be preceded by a forward slash character '/'. An example:


Note: Windows file paths are not proper URIs.

Only the slash (/) character is used as a path delimeter in URIs. Windows uses the backslash (\) to delimit path segments. Using the backslash can result in incorrect URI processing. "A\B\C" is considered one path segment. If using "file:///A\B\C" as a base URI and trying to resolve "../doc.dae" the result will be "file:///doc.dae" and not "file:///A\B\doc.dae" as one might have expected.


The following are some examples of converting a file path to a URI.

Example Description File Path URI
Windows absolute path
Windows relative path
UNC path
Linux absolute path
Linux relative path

See also

External links