Home > Contents > Index >
ASSET.IMPORT
Parses XML and sets Sites variables which can then be gathered to set values in the asset.
Note
If you use
ASSET.IMPORT
to gather values into a flex asset, you must provide an asset subtype using theSUBTYPE
parameter.Syntax
<ASSET.IMPORT NAME="asset instance object" PREFIX="prefix" XML="XML code" FILE="pathname" [PUBID="publication ID"] [SUBTYPE="asset subtype"] />Parameters
NAME (required)
- Name of the asset instance object.
PREFIX (required)
- Prefix to use when setting ICS variable names. The variable names are prefix:attribute.
XML (required if FILE not specified)
- XML code that is parsed.
FILE (required if XML not specified)
- Path to file containing XML code that is parsed. This parameter takes precedence over XML.
PUBID (optional)
- Site (formerly publication) ID.
SUBTYPE (optional, unless using this tag for a flex asset)
- Asset subtype.
Error Numbers
The possible values of
errno
include:
Value Description -408 Bad XML syntax. -10004 A required parameter is missing. -10005 The requested object is not in the object pool (is not loaded intomemory). -12004 An asset was not found for a specified ID. -12037 Required field missing. -12038 Incorrect data type. -12043 Data out of range. -12060 A field sent to the save asset function (after XML parsing) was too long. -12066 No subtype supplied or the supplied subtype is incorrect.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.
<SETVAR NAME="errno" VALUE="0"/> <SETVAR NAME="errdetail1" VALUE="01"/> <!-- To import `HomePage Stories' which is a row of Collection --> <SETVAR NAME="id" VALUE="968769614795"/> <SETVAR NAME="AssetType" VALUE="Collection"/> <SETVAR NAME="exportFL" VALUE="LocalFields,Association-named,Association-unnamed,Publist"/> <!-- The output file location --> <SETVAR NAME="output" VALUE="C:/temp/export.xml"/> <SETVAR NAME="impTime" VALUE="imported CS.SQLDate"/> <!-- Login --> <USER.LOGIN USERNAME="xceladmin" PASSWORD="xceladmin" /> <!-- Load the Collection with id specified earlier --> <ASSET.LOAD NAME="assetName1" TYPE="Variables.AssetType" OBJECTID="Variables.id"/> <br/><br/>ASSET.LOAD: Error #: <CSVAR NAME="Variables.errno"/>, Error Detail: <CSVAR NAME="Variables.errdetail1"/> <ASSET.SCATTER NAME="assetName1" PREFIX="exportPrefix1" EXCLUDE="true" /> <br/><br/>ASSET.SCATTER: Error #: <CSVAR NAME="Variables.errno"/>, Error Detail: <CSVAR NAME="Variables.errdetail1"/> <!-- Get the subtype for this asset --> <ASSET.GETSUBTYPE NAME="assetName1" /> <br/><br/>ASSET.GETSUBTYPE: Error #: <CSVAR NAME="Variables.errno"/>, Error Detail: <CSVAR NAME="Variables.errdetail1"/> <br/>ASSET.GETSUBTYPE: Subtype: <CSVAR NAME="Variables.subtype"/> <!-- Export the asset --> <ASSET.EXPORT NAME="assetName1" PREFIX="exportPrefix1" OUTPUT="exportOutput" /> <br/><br/>ASSET.EXPORT: Error #: <CSVAR NAME="Variables.errno"/>, Error Detail: <CSVAR NAME="Variables.errdetail1"/> <!-- Write the xml to a desired location --> <WRITEFILE STR="Variables.exportOutput" FILE="Variables.output"/> <br/><br/>WRITEFILE: Error #: <CSVAR NAME="Variables.errno"/>, Error Detail: <CSVAR NAME="Variables.errdetail1"/> <!-- Create a new asset for importing the exported file --> <ASSET.CREATE NAME="newAsset" TYPE="Variables.AssetType"/> <br/><br/>ASSET.CREATE: Error #: <CSVAR NAME="Variables.errno"/>, Error Detail: <CSVAR NAME="Variables.errdetail1"/> <!-- Import the asset in the newly created asset --> <ASSET.IMPORT NAME="newAsset" PREFIX="exportPrefix1" XML="Variables.exportOutput" /> <br/><br/>ASSET.IMPORT: Error #: <CSVAR NAME="Variables.errno"/>, Error Detail: <CSVAR NAME="Variables.errdetail1"/> <ASSET.GATHER NAME="newAsset" PREFIX="exportPrefix1" FIELDLIST="Variables.exportFL"/> <br/><br/>ASSET.GATHER: Error #: <CSVAR NAME="Variables.errno"/>, Error Detail: <CSVAR NAME="Variables.errdetail1"/> <!-- Set the name of the asset to the imported+current time --> <ASSET.SET NAME="newAsset" FIELD="name" VALUE="Variables.impTime"/> <br/><br/>ASSET.SET: Error #: <CSVAR NAME="Variables.errno"/>, Error Detail: <CSVAR NAME="Variables.errdetail1"/> <!-- Save the asset --> <ASSET.SAVE NAME="newAsset"/> <br/><br/>ASSET.SET: Error #: <CSVAR NAME="Variables.errno"/>, Error Detail: <CSVAR NAME="Variables.errdetail1"/> <ASSET.GET NAME="newAsset" FIELD="name" OUTPUT="getNameOut" /> <br/><br/>ASSET.GET: Error #: <CSVAR NAME="Variables.errno"/>, Error Detail: <CSVAR NAME="Variables.errdetail1"/> <BR/> <CSVAR NAME="Variables.getNameOut"/> <ASSET.GET NAME="newAsset" FIELD="subtype" OUTPUT="getTypeOut" /> <br/><br/>ASSET.GET: Error #: <CSVAR NAME="Variables.errno"/>, Error Detail: <CSVAR NAME="Variables.errdetail1"/> <BR/> <CSVAR NAME="Variables.getTypeOut"/> <ASSET.GET NAME="newAsset" FIELD="updatedby" OUTPUT="getUserNameOut" /> <br/><br/>ASSET.GET: Error #: <CSVAR NAME="Variables.errno"/>, Error Detail: <CSVAR NAME="Variables.errdetail1"/> <BR/> <CSVAR NAME="Variables.getUserNameOut"/>See Also
Home > Contents > Index > ![]()
Oracle XML Tag Reference
Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.