Script functionPre-defined run book template in the Automation Engine. One single step only, e.g. Start Windows Service, Copy file,…: Adds a new attribute to an XML element or changes an existing one.
XML_SET_ATTRIBUTE(Element, Attribute, Value)
Syntax part |
Description/format |
---|---|
Element |
Reference to the element whose attribute will be changed or to which the new attribute will be added. |
Attribute | Name of the attribute proceeded by the '@' character Format: scriptA particular Automation Engine object type. literal or script variableA placeholder for a value within a script. |
Value | Value of the attribute Format: script literal or script variable |
Return code |
---|
'0' – The attribute was successfully changed/added. |
The script element changes an attribute of an element that is located in the XML document that is open (XML_OPEN). You need to specify a reference to the element and the name and value of the attribute. If the attribute you entered is not located, it will be added to the element again.
Please note that only the element stored in the memory will be changed. The Documentation tab is not affected by this.
A runtimeThe duration of a task's execution. It refers to the period between a task's start and end. It does not include its activation period (see also: activation and start). error occurs if an '@' character is not entered before the name of the attribute.
The following example opens a structured Documentation tab as an XML document and selects the 'Child' element. The new 'Attribute1' attribute will then be added to the element. If successfully added, the set attribute will then be read once more as a check and the value will be written to the activation log.
:SET &XMLDOCU#=XML_OPEN(DOCU,,"@Details")
:IF &XMLDOCU# <> ""
:SET &ELEMENT# = XML_SELECT_NODE(&XMLDOCU#,"Child")
:SET &RET# = XML_SET_ATTRIBUTE(&ELEMENT#,"@Attribute1","Value1")
:IF &RET# = 0
:SET &ATT# = XML_GET_ATTRIBUTE(&ELEMENT#,"@Attribute1")
:P &ATT#
:ENDIF
:ENDIF
:XML_CLOSE &XMLDOCU#
See also:
Script element | Description |
---|---|
XML_OPEN | Opens an XML document for processing. |
:XML_CLOSE | Closes an XML document. |
Script Element – Reading or Modifying Objects
Examples
Determining the Error Message and Number
About the Script
Script Elements – Alphabetical Listing
Script Elements – Ordered by Function
Automic Documentation - Tutorials - Automic Blog - Resources - Training & Services - Automic YouTube Channel - Download Center - Support |
Copyright © 2016 Automic Software GmbH |