<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <!-- Define the XML Schema of a transaction -->
  <xs:element name="journal">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="transaction" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="title" type="xs:string" minOccurs="0"/>
              <xs:element name="start_date" type="xs:string"/>
              <xs:element name="stop_date" type="xs:string"/>
              <xs:element name="reference" type="xs:string"/>
              <xs:element name="currency" type="xs:string"/>
              <xs:element name="payment_mode" type="xs:string"/>
              <xs:element name="category" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
              <xs:element name="arrow" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:sequence>
                  <xs:element name="source" type="xs:string" minOccurs="0"/>
                  <xs:element name="destination" type="xs:string" minOccurs="0"/>
                  </xs:sequence>
                  <xs:attribute name="type" use="required"/>
                </xs:complexType>
              </xs:element>
              <xs:element name="movement" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:sequence>
                  <xs:element name="resource" type="xs:string"/>
                  <xs:element name="title" type="xs:string" minOccurs="0"/>
                  <xs:element name="reference" type="xs:string" minOccurs="0"/>
                  <xs:element name="quantity" type="xs:float"/>
                  <xs:element name="price" type="xs:float"/>
                  <xs:element name="VAT" type="xs:string"/>
                  <xs:element name="category" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="type" use="required"/>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>