URI: Difference between revisions
Line 62: | Line 62: | ||
| | | | ||
file:///c:/path/document.dae#Light01 | file:///c:/path/document.dae#Light01 | ||
|} | |} | ||
In the last example, a leading "/" character is added to make it a relative reference. Otherwise, the string <code>c:/path/document.dae</code> would be interpreted as a URI with scheme ''c'', which probably isn't what the author intended. | |||
==See also== | ==See also== |
Revision as of 02:07, 26 May 2007
A uniform resource identifier (URI) is a standard way of referencing elements, objects, files, and so on.
URIs
The basic URI syntax is:
scheme://authority/path?query#fragment
Examples of URIs include
file:///home/sthomas/models/cube.dae file:///C:/models/sphere.dae#myGeometry http://www.google.com/
The following table shows the breakdown of each URI component in the previous examples.
URI | Scheme | Authority | Path | Query | Fragment |
---|---|---|---|---|---|
file:///home/sthomas/models/cube.dae | file | - | /home/sthomas/models/cube.dae | - | - |
file:///C:/models/sphere.dae#myGeometry | file | - | /C:/models/sphere.dae | - | myGeometry |
http://www.google.com/ | http | www.google.com | - | - | - |
URI references
Many XML-based formats (including COLLADA) primarily use URI references. URI references are a superset of URIs. A URI reference is either a URI or a relative reference. A URI reference is a relative reference if it doesn't include the scheme:
prefix. Before a relative reference can be used, it must be converted to a URI in a process called reference resolution. The reference resolution algorithm combines the relative reference with a base URI to form the full URI that is then used by the application.
Below are some examples of URI references. These examples are full URIs (since they include the scheme:
prefix). Since these are full URIs, they can be used directly by an application without being resolved.
file:///home/sthomas/models/cube.dae file:///C:/models/sphere.dae#myGeometry http://www.google.com/
Here are some more examples of URI references. Since these references don't include a scheme:
prefix, they're relative references and will need to be resolved before they can be used by an application.
/home/sthomas/models/cube.dae /C:/models/sphere.dae#myGeometry ../../image.jpg #redMaterial
Relative reference resolution
A relative reference is combined with a base URI to yield a full URI in a process called reference resolution. The full algorithm is given here.
Assuming a base URI of
file:///C:/A/B/C/D/doc.dae
here are some examples of how relative references would be resolved:
Relative Reference | Resolved URI |
---|---|
./path/document.dae |
file:///c:/A/B/C/D/path/document.dae |
../../../path/document.dae#elementID |
file:///A/path/document.dae#elementID |
/c:/path/document.dae#Light01 |
file:///c:/path/document.dae#Light01 |
In the last example, a leading "/" character is added to make it a relative reference. Otherwise, the string c:/path/document.dae
would be interpreted as a URI with scheme c, which probably isn't what the author intended.