История страницы
Create new with XSD Version 8 (Net)
Action group: XML
...
Description
The action creates the XML-file context according to the schema specified in the XSD-file.
Action icon
Settings of parameters
Parameter | Description |
---|---|
XSD-file | Path to the file with .xsd extension that contains an XML schema. |
Options | A collection with the values of the elements to be set. |
Output parameters
Context - context of a new XML-document.
Settings
Property | Description | Type | Filling example | Mandatory field |
Parameters | ||||
XSD file | File with XSD-scheme | Robin.FilePath | Yes | |
Options | Value of parameters | Robin.Collection | No | |
Results | ||||
Context | Context of a new XML document | Robin.XML | XML context |
More about
Описание
Действие создает контекст XML-файла по схеме, указанной в XSD-файле
Иконка действия
Параметры
Входные параметры
XSD-файл Файл, определяющий правила создания XML
Параметры Значения параметров для подстановки
Выходные параметры
Контекст XML-контекст
Настройки
...
Путь к файлу
Robin.FilePath
...
Коллекция
Robin.Collection
...
Контекст
...
XML-контекст
...
Идентификатор контекста XML
Robin.XML
...
Подробнее о XSD https://habr.com/ru/post/90696/
Особые условия использования
В действие заложена "проверка" типов данных, переданных в коллекцию:
- Если переданные данные из коллекции, не соответствуют типам данных XSD-файла, то выдается сообщение: "Тип значений, указанных в коллекции, не соответствуют типам данных, которые указаны в XSD-файле."
- Если в коллекции не указаны значения для обязательных параметров, то выдается сообщение: "В коллекции не указаны значения для элементов, которые указаны в XSD-файле как обязательные."
- Если пользователь указывает некорректный параметр, то выдается сообщение: "Указан файл с некорректным расширением. Допустимое расширение - xsd."
- Если пользователь указывает невалидный XSD-файл (неправильный синтаксис), то выдается сообщение: "Указанный файл имеет недопустимый синтаксис."
Пример использования (нужно менять)
Задача
Создать новый контекст по работе с XML- документом, используя XSD.
Решение
Воспользоваться действием "Создать по XSD".
Реализация
- Перенести действие "Создать по XSD" на рабочую область
- Настроить параметры действия "Создать по XSD".
В поле "XSD файл" указать путь к файлу, где хранится шаблон XSD файла или указать шаблон для XML файла, который будет указывать в каком порядке и какие элементы будут созданы в XSD - файле.
- В поле "Параметры" указать значения для элементов. Подстановка будет идти по порядку указания элементов.
Нажать на кнопку "Старт" в верхней панели.
Результат:
Программный робот отработал успешно.
Посмотреть результат можно в файле File_XSD по адресу, куда был сохранен файл
Результат можно посмотреть в файле File_XSD по адресу, куда был сохранен файл
Для того, чтобы указать шаблон для XML файла, который будет указывать в каком порядке и какие элементы будут созданы в XSD - файле нужно:
...
- В поле "Параметры" указать значения для элементов. Подстановка будет идти по порядку указания элементов
Special conditions of use
The action involves "checking" the types of data passed to the collection:
- If the transferred data from the collection does not match the data types of the XSD-file, the following message is displayed: "The type of values specified in the collection do not match the data types that are specified in the XSD-file."
- If no values for mandatory parameters are specified in the collection, the following message is displayed: "The collection does not contain values for items that are specified as mandatory in the XSD-file".
- If the user specifies an invalid parameter, the following message will be displayed: "Specified file has an invalid extension. The valid extension is xsd."
- If the user specifies an invalid XSD-file (invalid syntax), the following message will be displayed: "The specified file has invalid syntax".
Example of use
Task
Create a new context on working with XML-documents using XSD.
Solution
Use the "Create new with XSD" action.
Implementation
- Move the "Create new with XSD" action to the workspace.
- Set the "Create new with XSD" action parameters.
In the "XSD-file" field, specify the path to the file where the XSD-file template is stored or specify a template for XML-file, which will specify in what order and which elements will be created in the XSD-file.
- In the "Parameters" field set elements parameters.The substitution will follow the order in which the elements are specified.
Click "Start" in the top panel.
Result
The program robot completed successfully.
You can see the result in the File_XSD file at the address where the file was saved to.
You can see the result in the File_XSD file at the address where the file was saved to
In order to specify a template for XML-file, which will specify in what order and which elements will be created in XSD-file do the following:
- In the "XSD-file" field specify "XSD" parameter.
- In the "Parameters" field set values for the elements. The substitution will follow the order in which the elements are specified.
After setting the parameters, similarly to the previous example, click "Start" and start the robot schemeПосле задания параметров нужно аналогично предыдущему примеру нажать на "Старт" и запустить схему робота.