Home > Contents > Index >
asset:export
Gathers Sites variables to create an XML rendition of an asset.
Syntax
<asset:export name="asset instance object" prefix="prefix" [output="variable name"] [file="output file name"] /> [writeattrvalue="true|false"] />Parameters
name (required)
- Name of the asset instance object.
prefix (required)
- First part of the name of all variables and lists to be gathered and used to genreate the XML. Variables are named with the prefix, a delimiter, then the field name, for example,
prefix:fieldname
.
output (optional)
- Name of the output variable. This variable contains the resulting XML. Either output or file parameter is required.
file (optional)
- Name of the filename in which to write the XML. Either file or output parameter is required.
writeattrvalue (optional)
- Indicates whether to write the data of the attribute within the XML attribute tag or not. The default setting is true. If set to true the xml output for a simple string attribute will look like:
Otherwise, the xml output for a simple string attribute will look like:
<attribute name="simple"> <string value="the value for the string"/> </attribute>
<attribute name="simple"> <string> the value for the string </string> </attribute>
Description
The tag gathers previously scattered Sites variables of an asset and generates XML data describing all the scattered data of that variable. The XML can be written to a file or another Sites variable. Writing to a file is preferable for any asset which has a lot of data.
Error Numbers
The possible values of
errno
include:
Value Description -301 Error writing file. -10004 A required parameter is missing. -10005 The requested object is not in the object pool (is not loaded into memory).Example
The following code is an example of how to export a simple asset and import it in a newly created asset. This code exports a 'Collection' with id 968769614795 and then imports it into the new asset.
<asset:load name="assetname1" type="Collection" objectid="968769614795"/> <%// Scatter all fields of the asset into Sites variables //%> <asset:scatter name="assetname1" prefix="exportprefix1" exclude="true" /> <%// Generate the XML and put it in Sites Variables.exportoutput //%> <asset:export name="assetname1" prefix="exportprefix1" output="exportoutput" /> <%// Create a new asset for importing the exported file //%> <asset:create name="newasset" type="Collection"/> <%// Scatter all fields of the XML into Sites variables //%> <asset:import name="newasset" prefix="importprefix1" xml='<%=ics.GetVar("exportoutput")%>' /> <%// Gather the variables into the newly created asset //%> <asset:gather name="newasset" prefix="importprefix1" fieldlist="*"/> <%// Set the name of the asset to "Copy of [name]" //%> <asset:set name="newasset" field="name" value='<%="Copy of " +ics.GetVar("exportprefix1:name")%>' /> <%// Save the asset //%> <asset.save name="newasset"/>See Also
asset:import
asset:load
asset:scatter
Home > Contents > Index > ![]()
Oracle JSP Tag Reference
Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.