Loading dae file from memory

Hello everybody,

When loading dae file from memory, I need to provide a name:

dae->load(“file://./test.dae”, memoryBlock);

But I found that the name must be the exact location of the dae file, otherwize the getElement() function of daeURI objects will always return NULL.

If the dae is streamed from network, do I need to save the stream to a file in order to load it correctly? Is there any better way to load dae from memory?

Thanks!

The scheme can only be used for absolute URI. (‘file:’ and ‘http:’ are schemes)

You will have to construct the absolute URI in your application from where the file is supposed to be located. The DOM can help with this, since it has an API to set the base URI for the document, that will subsequently be appended to the parameter passed in the load() API, forming the absolute URI.

BTW, “file://./test.dae” is an invalid URI. It lacks the host part, it should be using “///” which is the same as “//localhost/”. But it is still not a relative path, basically the “./” will be ignored.

If the dae is streamed from network, do I need to save the stream to a file in order to load it correctly? Is there any better way to load dae from memory?

The COLLADA DOM should support the ‘http:’ scheme, since it is built in libXML2.

Thank you! remi.

I found that I don’t need to provide the exact location. It works if the scheme and the file extension are correct. Thanks!

Mannam,

Can you please post an example of what you mean when you say it works?

Thanks.

For the following case, the extension is not supported, daeURI fails,

dae->load(“file:///test.abc”, memoryBlock);

but if I use valid scheme and extension,

dae->load(“file:///test.dae”, memoryBlock);

daeURI works even the file test.dae does not exist.