1

При валидаии возникает ошибка : Cvc-complex-type.2.4.a: Invalid Content Was Found Starting With Element 'goods'. One Of '{goods}' Is Expected., Line '5', Column '8'.

XML code

<CommonStorage xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schema.xsd" xmlns="CommonStorage">

<goods>
  <name>Tea</name>
  <count>49</count>
  <price>20</price>
  <item_id>100</item_id>
</goods>

<goods>
  <name>laptop</name>
  <count>32</count>
  <price>8000</price>
  <item_id>101</item_id>
</goods>


<history>
  <room>1</room>
  <rack>1</rack>
  <shelf>1</shelf>
  <position>R</position>
  <date>2018-03-31</date>
  <item_id>100</item_id>
</history>

<history>
  <room>2</room>
  <rack>2</rack>
  <shelf>2</shelf>
  <position>l</position>
  <date>2018-09-28</date>
  <item_id>101</item_id>
</history>


<racks>
  <rack_id>1</rack_id>
</racks>

<racks>
  <rack_id>2</rack_id>
</racks>


<rooms>
  <room_id>1</room_id>
</rooms>

<rooms>
  <room_id>2</room_id>
</rooms>


<shelves>
  <shelf_id>1</shelf_id>
</shelves>

<shelves>
  <shelf_id>2</shelf_id>
</shelves>

<shelves>
  <shelf_id>5</shelf_id>
</shelves>


<storage>
  <room>1</room>
  <rack>1</rack>
  <shelf>1</shelf>
  <position>L</position>
  <item_id>100</item_id>
</storage>

<storage>
  <room>2</room>
  <rack>2</rack>
  <shelf>2</shelf>
  <position>R</position>
  <item_id>101</item_id>
</storage>


<valueble_goods>
  <item_id>11100</item_id>
  <name>Laptop</name>
  <count>35</count>
  <price>15000</price>
</valueble_goods>

<valueble_goods>
  <item_id>11101</item_id>
  <name>Laptop11</name>
  <count>35</count>
  <price>10000</price>
</valueble_goods>

<valueble_goods>
  <item_id>101</item_id>
  <name>laptop</name>
  <count>2</count>
  <price>10000</price>
</valueble_goods>


</CommonStorage>

XS Schema

    <?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:e="CommonStorage" targetNamespace="CommonStorage" elementFormDefault="unqualified">


<xs:element name="CommonStorage">
  <xs:complexType>
    <xs:sequence>


<xs:element name="goods" >
               <xs:complexType>
                  <xs:sequence>
                     <xs:element name="name" type="xs:string" />
                     <xs:element name="count" type="xs:decimal" />
                     <xs:element name="price" type="xs:decimal" />
                     <xs:element name="item_id" type="xs:decimal" />
                  </xs:sequence>
               </xs:complexType>
            </xs:element>


<xs:element name="valuable_goods">
               <xs:complexType>
                  <xs:sequence>
                    <xs:element name="item_id" type="xs:decimal" />
                     <xs:element name="name" type="xs:string" />
                     <xs:element name="count" type="xs:decimal" />
                     <xs:element name="price" type="xs:decimal" />
                  </xs:sequence>
               </xs:complexType>
            </xs:element>

            <xs:element name="history">
               <xs:complexType>
                  <xs:sequence>
                     <xs:element name="room" type="xs:decimal" />
                     <xs:element name="rack" type="xs:decimal" />
                     <xs:element name="shelf" type="xs:decimal" />
                     <xs:element name="position" type="xs:string"  />
                     <xs:element name="date" type="xs:date" />
                     <xs:element name="item_id" type="xs:decimal" />
                  </xs:sequence>
               </xs:complexType>
            </xs:element>

            <xs:element name="storage">
               <xs:complexType>
                  <xs:sequence>
                     <xs:element name="room" type="xs:decimal" />
                     <xs:element name="rack" type="xs:decimal" />
                     <xs:element name="shelf" type="xs:decimal" />
                     <xs:element name="position" type="xs:string"  />
                     <xs:element name="item_id" type="xs:decimal" />
                  </xs:sequence>
               </xs:complexType>
            </xs:element>


<xs:element name="racks">
               <xs:complexType>
                  <xs:sequence>
                     <xs:element name="rack_id" type="xs:decimal" />
                  </xs:sequence>
               </xs:complexType>
            </xs:element>

            <xs:element name="rooms">
               <xs:complexType>
                  <xs:sequence>
                     <xs:element name="room_id" type="xs:decimal" />
                  </xs:sequence>
               </xs:complexType>
            </xs:element>

            <xs:element name="shelves">
               <xs:complexType>
                  <xs:sequence>
                     <xs:element name="shelf_id" type="xs:decimal" />
                  </xs:sequence>
               </xs:complexType>
            </xs:element>


    </xs:sequence>
  </xs:complexType>
</xs:element>

</xs:schema>

1 ответ 1

0

у Вас указан для чисел тип decimal, а вводятся целые числа. Возможно, в этом дело...

2
  • к сожалению нет( но спасибо за попитку)
    – Tuha Khoma
    30 окт 2019 в 9:04
  • данный ответ можно оформить как комментарий
    – Dmitry
    10 мар 2022 в 9:07

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.