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
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)
            // 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.


  • Depending on the type parameter, if set to xml, then Corrade can import just a structure of primitives based on an XML file generated within the ZIP file returned by the exportxml command or, if type is set to zip, Corrade can import both the structure and upload any necessary textures.
  • When importing XML files, the data parameter expects to be set to the contents of an XML file. Otherwise, when importing ZIP files, the data parameter expects to be set to the Base64 encoding of a ZIP file.
  • Most likely, the XML file length or the Base64 string resulting from the encoding of the ZIP file will be too large for LSL to handle. In such cases, it is recommended to use Corrade's internal web-server to work around the limitations of LSL scripts.

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:

  • The ZIP file should contain a single XML file describing a primitive structure.
  • Any other file in the ZIP file should be an image file in an exportxml compatible format and named as the UUID referenced by the XML file.

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



  • 3736068e-ea9c-bceb-8396-f11bacd66103.j2c is an image file in JPEG2000 codestream format representing a texture with UUID 3736068e-ea9c-bceb-8396-f11bacd66103.
  • TestExport.xml is the structure of primitives to import. Most likely, the TestExport.xml file should reference the UUID 3736068e-ea9c-bceb-8396-f11bacd66103 which corresponds to the image file found in the same ZIP file.

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.

secondlife/scripted_agents/corrade/api/progressive/commands/importxml.txt ยท Last modified: 2017/05/27 20:13 by Wizardry and Steamworks

Access website using Tor

For the copyright, license, warranty and privacy terms for the usage of this website please see the license and privacy pages.