Import XML


How to provide meta-information about a document with the „fields“ element.

Within the <fields> element, several meta-information about the document to import can be provided. The subsequent table contains the possible child elements in the exact order in which they must appear inside the <fields> element. If not stated differently, the elements may be empty.

<site>The site to import the document to. This may only be emtpy, if the site can be determined from the <structureNode> element, an existing document is updated (the existing site structure is kept), the site is defined by a site mapping (see site mappings) or the default site defined in the instance configuration.<site>demo</site>
<structureNode>The structure node of the site. May only be empty, if an existing document is updated (the existing location is kept), the structure node is defined by a site mapping or default structure node in defined in the instance configuration.<structureNode>/multimedia/bilder </structureNode>
<categories>This field has been deprecated since Version 4.7.0 and will be removed from Sophora 5.0
The categories that are assigned to this document. Every assigned category has to be provided using an individual <category> element as a child element. The content of a <category> element has to contain the entire path of the category (path elements are separated by semicolons). If no <category> element is present, either no categories are assigned or the existing ones are kept (if it is an update of an existing document).
Additionally, by using the attribute remove="true" for the categories element you can reset a document's categories.

<categories remove="true" />
<idstem>The ID stem is the basis of the Sophora ID. It may be comprised of lower and upper case letters in combination with "_" and "-". This element may only be empty, if an existing document.<idstem>importimage</idstem>
<forceLock>Defines whether to break a document's lock if it is locked by another user. If this value is false and the document to import is locked by another Sophora user, the import fails. If it is true, the lock is broken, i.e. taken from the user. Possible values are true or 1 and false or 0. The default value is false.

Optional attribute timeout:
This attribute specifies a timeout in minutes for the importer for trying to obtain the lock of the document. If the document is locked by a user, the importer will show a dialog in the DeskClient to the user holding the lock, asking her to release it. The dialog will be shown every two minutes until the lock is released or the timeout is reached. If the timeout is reached, the lock will be broken if forceLock is true; otherwise, the import will fail. While waiting for the user to release the lock, the current import is put on hold and the importer will continue to process other imports.
If the timeout attribute is not set on the forceLock element and the document is locked, the importer will immediately break the lock or fail the import, depending on the element value.

Optional attribute retryInterval:
This attribute specifies an interval in minutes that the importer will use when re-trying to obtain the lock of the document. (Default: 2)
<forceCreate>Determines whether a new document will be created, if the specified external ID already exists. Possible values are true or 1 and false or 0 whereas false is the default value.
If the external ID of the document to import is given and the repository already contains this ID, the external ID of the document to import is modified and a new document will be created.
<forceCreate>true</forceCreate> |
<channels>Lists of channel names for which the document is activated or deactivated. See "Channels" below.

The following example shows typical fields of an import XML. Such XML will force the lock of the document to import (achieved locks of other Sophora users will be broken!) and will not create new document automatically, if the given external ID already exists in the Sophora repository:

<?xml version="1.0" encoding="UTF-8"?>
<document nodeType="sophora-content-nt:imageobject"
  <resourceList />

Last modified on 10/16/20

The content of this page is licensed under the CC BY 4.0 License. Code samples are licensed under the MIT License.