Имя: Пароль:
1C
1C 7.7
v7: Чтение файла схемы XSD
,
0 Altanzar
 
24.12.19
19:15
Добрый вечер, суть такова.
По причине грядущей повальной маркировки появилась необходимость вкатиться в XSD.
Имеется файл со схемой, которая выглядит вот так:

<xs:schema elementFormDefault="qualified">
<xs:include schemaLocation="LP_base_types_v2.xsd"/>
<xs:element name="acceptance" type="acceptance"/>
<xs:complexType name="acceptance">
<xs:annotation>
<xs:documentation>Приемка</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="shipment_id" type="guid_type">
<xs:annotation>
<xs:documentation>Номер документа отгрузки</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="trade_participant_inn_sender" type="inn_type">
<xs:annotation>
<xs:documentation>ИНН отправителя</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="trade_participant_inn_receiver" type="inn_type">
<xs:annotation>
<xs:documentation>ИНН получателя</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="trade_participant_inn_owner" type="inn_type" minOccurs="0">
<xs:annotation>
<xs:documentation>ИНН собственника</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="shipment_date" type="datetimeoffset_type">
<xs:annotation>
<xs:documentation>Дата и время отгрузки</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="reception_date" type="datetimeoffset_type">
<xs:annotation>
<xs:documentation>Дата и время приемки</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="transfer_date" type="date_type">
<xs:annotation>
<xs:documentation>Дата отгрузки</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="move_document_number" type="string255_type">
<xs:annotation>
<xs:documentation>Номер первичного документа</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="move_document_date" type="date_type">
<xs:annotation>
<xs:documentation>Дата первичного документа</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="turnover_type" type="turnover_enum_type" minOccurs="0">
<xs:annotation>
<xs:documentation>Вид оборота товара</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="release_method" type="release_method_type" minOccurs="0">
<xs:annotation>
<xs:documentation>Способ ввода товаров в оборот</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="products_list">
<xs:annotation>
<xs:documentation>Параметры товаров</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="product" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>Параметры товара</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="ki" minOccurs="0" type="kit_type">
<xs:annotation>
<xs:documentation>КИ</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="kitu" minOccurs="0" type="kitu_type">
<xs:annotation>
<xs:documentation>КИТУ</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="accept_type" type="xs:boolean">
<xs:annotation>
<xs:documentation>Товар принят</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="cost" minOccurs="0" type="price_type">
<xs:annotation>
<xs:documentation>Цена за единицу</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="vat_value" minOccurs="0" type="price_type">
<xs:annotation>
<xs:documentation>Сумма НДС</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="action_id" type="xs:int" use="required" fixed="11"/>
<xs:attribute name="version" type="xs:decimal" use="required" fixed="5"/>
</xs:complexType>
</xs:schema>

Я создаю фабрику методом СоздатьФабрикуXDTO(ИмяФайлаСхемы), однако непонятно, как получить тип "acceptance" и прочие - пространство имен не объявлено.
1 Fragster
 
гуру
24.12.19
19:21
это точно v7?
2 Fragster
 
гуру
24.12.19
19:21
а вообще там же написано: еще смотри в LP_base_types_v2.xsd
3 Fragster
 
гуру
24.12.19
19:21
нужно все нужные файлики положить рядом и создать фабрику из массива файлов
4 Altanzar
 
24.12.19
19:26
Fragster
С v7 каюсь, промазал.
За подсказку с массивом спасибо, но в LP_base_types_v2.xsd пространство имен тоже не объявлено. Оно начинается так:

<xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:simpleType name="IPv4Address_type">
<xs:annotation>
<xs:documentation>IPv4. Запись в виде четырёх десятичных чисел (от 0 до 255), разделённых точками. </xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="((1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])"/>
</xs:restriction>
</xs:simpleType>

И дальше только объявление типов, и все.
5 Fragster
 
гуру
24.12.19
19:29
ну тогда остается только предварительно самому добавить нужные (вероятно xmlns:xs="http://www.w3.org/2001/XMLSchema"; )
6 Fragster
 
гуру
24.12.19
19:30
прям в файл перед засовыванием в фабрику
7 Fragster
 
гуру
24.12.19
19:31
ну и xmlns="что-то твое", что потом вырезать из получившегося файла :)
Основная теорема систематики: Новые системы плодят новые проблемы.