Вы просматриваете старую версию данной страницы. Смотрите текущую версию.

Сравнить с текущим просмотр истории страницы

« Предыдущий Версия 4 Следующий »

Add element Version 4 (Net)

Action group: XML


Description

The action adds an element to the open context.

Action icon

Parameters

Input parameters

ParameterDescription
ContextXML-context.
XPathPath to the element in relation to which the new one will be created.
Tag nameTag name of the element to be created.
ValueContent for the element to be created. 
AttributeA dictionary of parameters to be added to the element and their values.
Adding modeDetermines 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

СвойствоАнгл. наименованиеОписаниеТипПример заполненияОбязательность заполнения поля
Параметры

Контекст

Context name

XML-контекст.

Идентификатор контекста XML
Да
XPathXPath

Путь к элементу, относительно которого будет создаваться новый.

Строка

Нет
Имя тэгаTag nameИмя тега для создаваемого элемента.Строка
Да
ЗначениеValueКонтент для создаваемого элемента.Строка
Нет
ПараметрыOptionsСловарь параметров, которые нужно добавить к элементу, и их значений.Словарь
Нет
Режим добавленияAdding mode

Определяет, куда будет добавлен новый элемент относительно якорного элемента.


  • Перед элементом
  • После элемента
  • Верхний дочерний
  • Нижний дочерний

По умолчанию "Нижний дочерний"

Для пустого контекста параметр не принимается во внимание, так как элемент будет добавлен как корневой.

 

Строка
Нет

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="The Adventures of Huckleberry Finn" and AUTHOR="Mark Twain". Save the resulting XML to the workspace. 

Solution

Use the "Create new", "Add element", "Save to file" actions.

Implementation

  1. Assemble a robot scheme with the actions.

  2. Set the "Create new" action parameter.

  3. Set the "Add element" action parameters. (for root element INVENTORY).

  4. Set the "Add element" action parameters (for element BOOK).


    In the "Attributes" field specify attributes for the BOOK element.


  5. Set the "Save to file"action parameters.
  6. Click "Start" in the top panel.

Result

The program robot completed successfully.

The created XML is saved to the workspace.


 

  • Нет меток