Table of Contents

Import an Object Based on an XML File

27 May 2017

  • Release 9.164 - added optional region parameter.

13 July 2016

  • Release 9.105 - added.
importxml (Commands)
TypeCorrade progressive command
Commandimportxml
DescriptionThe importxml command can be used to import an object based on a previous an XML export.
Permissionsinteract, economy (if type is set to zip and textures have to be uploaded)
Parametersgroup, password, data, position, type
Last ChangesRelease 9.105 - added.

The importxml command can be used to import an object based on a previous an XML export.

Command Required Parameters Required Corrade Permissions Example
importxml group, password, data, position, type interact, economy (if type is set to zip and textures have to be uploaded)
llInstantMessage(CORRADE,
    wasKeyValueEncode(
        [
            // Import an object based on an XML file.
            "command", "importxml",
            "group", wasURLEscape(GROUP),
            "password", wasURLEscape(PASSWORD),
            // Import the object at this position.
            // In other words, set the root of the 
            // object to this position.
            "position", wasURLEscape("<137.697296, 159.511642, 3400.75>"),
            // Use an XML file to create a structure
            // without attempting to upload any textures.
            "type", "xml",
            // The XML file previously exported 
            // with the "exportxml" command.
            "data", wasURLEscape("<llsd><map><key>160378505</key><map><key>name</key><string>..."),
            "callback", wasURLEscape(URL)
        ]
    )
);
Optional Parameter Possible Value Meaning
permissions Permissions expressed in Corrade permission notation. The permissions to set on all the created primitives.
region A region name. Attempt to perform the command on the specified region. Note that Corrade must be connected to that region. If in doubt, please use the getconnectedregions command to determine whether the region you want to specify is currently connected.
Parameter Possible Value Second Parameter Possible Value Optional Parameter Possible Value Meaning
type xml data A string representing an XML file. Import a structure of primitives based on an XML file.
zip A Base64 encoded ZIP file. cache True (default) or False Import a ZIP bundle by uploading the required textures and creating the primitives. By default Corrade will not upload textures that are to be found in the cache.

Notes

Contents of a ZIP file

ZIP files generated by using the exportxml command are fully compatible with the importxml command. For completeness, here are a few remarks on the contents of the ZIP file that Corrade will recognize:

For instance, suppose that the contents of a ZIP file are the following:

3736068e-ea9c-bceb-8396-f11bacd66103.j2c
TestExport.xml

then:

Trusting the Cache

Since texture uploads may fail half-way through the import, Corrade by default will not re-upload textures that is aware of. The cache parameter, when set to True or omitted, will prevent Corrade from uploading any textures in the ZIP file that have been previously cached. This assumes that Corrade will be stationary on a single grid. You may have to set cache to False in order to upload textures that Corrade may have seen on a different grid but that do not exist on the current grid.

In case you are exporting and importing with Corrade, then most likely Corrade has already cached the textures within the ZIP file. In such cases, Corrade will avoid having to re-upload textures and will thereby not have to pay the upload fee again.

Furthermore, by not setting cache to False, if the process of uploading a texture fails or the entire import process fails, you can re-issue the importxml command and Corrade will skip the textures that it has already uploaded to the grid.