История страницы
Add element Version 4 (Net)
Action group: XML
...
Description
The action adds an element to the open context
Action icon
Settings of parameters
Parameter | Description |
---|---|
Context | XML-context. |
XPath | Path to the element in relation to which the new one will be created. |
Tag name | Tag name of the element to be created. |
Value | Content for the element to be created. |
Attribute | A dictionary of parameters to be added to the element and their values. |
Adding mode | Determines where the new element will be added relative to the anchor element. The default is "Append child". For an empty context, the parameter is ignored because the element will be added as the root element. |
Settings of parameters
Property | Description | Type | Filling example | Mandatory field |
Parameters | ||||
Context of the XML- document | Context of the XML-document | Robin.XML | XML context | Yes |
XPath | The path to the anchor XML-element, relative to which the new one will be created | Robin.String | No | |
Tag name | TagName for a new XML-element | Robin.String | Yes | |
Value | Content of the new XML-element | Robin.String | No | |
Attributes | Dictionary with attributes and their values for new XML-element | Robin.Dictionary | No | |
Adding mode | Determine position for new XML-element relative to the anchor XML-element. The default is Append Child. For empty context, the attribute is ignored as the element will be added as root | Robin.String | No |
Special conditions of use
None.
Example of use
Task
Create a new XML-document with a root element INVENTORY and a nested BOOK element that has attributes TITLE
Добавить элемент
Группа действий: XML
Добавляет элемент в открытый контекст.
Параметры
Входные параметры
Контекст - XML-контекст.
XPath - Путь к элементу, относительно которого будет создаваться новый.
Имя тэга - Имя тега для создаваемого элемента.
Значение - Контент для создаваемого элемента.
Параметры - Словарь параметров, которые нужно добавить к элементу, и их значений.
Режим добавления - Определяет, куда будет добавлен новый элемент относительно якорного элемента. По умолчанию "Нижний дочерний". Для пустого контекста параметр не принимается во внимание, так как элемент будет добавлен как корневой.
Настройки
...
Контекст
...
XML-контекст.
...
Путь к элементу, относительно которого будет создаваться новый.
...
Определяет, куда будет добавлен новый элемент относительно якорного элемента.
- Перед элементом
- После элемента
- Верхний дочерний
- Нижний дочерний
По умолчанию "Нижний дочерний"
Для пустого контекста параметр не принимается во внимание, так как элемент будет добавлен как корневой.
...
Особые условия использования
Отсутствуют.
Пример использования
Задача
Создать новый XML-документ с корневым элементом INVENTORY и вложенным в него элементом BOOK, который имеет атрибуты TITLE="The Adventures of Huckleberry Finn" и and AUTHOR="Mark Twain". Сохранить полученный XML на рабочий столSave the resulting XML to the workspace.
...
Solution
Воспользоваться действиями "Создать новыйUse the "Create new", "Добавить элементAdd element", "Сохранить в файл"Save to file" actions.
Реализация
Implementation
- Assemble a robot scheme with the actions.Собрать схему робота, состоящего из действий:
- Настроить параметр действия "Создать новый"Set the "Create new" action parameter.
- Настроить параметры действия "Добавить элемент". (для корневого элемента INVENTORY).
- Настроить параметры для действия "Сохранить в файл".
- Нажать на кнопку "Старт" в верхней панели.
В поле "Атрибуты" указать атрибуты для элемента BOOK.
Результат:
Программный робот отработал успешно.
Созданный XML сохранен на рабочем столе.
- Set the "Add element" action parameters. (for root element INVENTORY).
- Set the "Add element" action parameters (for element BOOK).
In the "Attributes" field specify attributes for the BOOK element. - Set the "Save to file"action parameters.
- Click "Start" in the top panel.
Result
The program robot completed successfully.
The created XML is saved to the workspace.