qualipool / swissrets

A swiss real estate transaction standard
https://swissrets.ch
MIT License
26 stars 18 forks source link

Is there a reason why gross is required? #193

Closed jensstalder closed 2 years ago

jensstalder commented 2 years ago

There are properties that only have net rent price. Probably what was meant is that at least one of the values needs to be defined.

now

<xs:element maxOccurs="1" minOccurs="0" name="rent">
  <xs:complexType>
    <xs:all>
      <xs:element maxOccurs="1" minOccurs="1" name="gross" type="xs:positiveInteger"/>
      <xs:element maxOccurs="1" minOccurs="0" name="net" type="xs:positiveInteger"/>
      <xs:element maxOccurs="1" minOccurs="0" name="extra" type="xs:positiveInteger"/>
    </xs:all>
    <xs:attribute name="interval" type="priceInterval" use="optional"/>
    <xs:attribute name="referring" type="priceReferring" use="optional"/>
  </xs:complexType>
</xs:element>

possible solution ? not sure if that is right though

<xs:element maxOccurs="1" minOccurs="0" name="rent">
  <xs:complexType>
    <xs:choice minOccurs="1" maxOccurs="unbounded">
      <xs:element maxOccurs="1" minOccurs="0" name="gross" type="xs:positiveInteger"/>
      <xs:element maxOccurs="1" minOccurs="0" name="net" type="xs:positiveInteger"/>
      <xs:element maxOccurs="1" minOccurs="0" name="extra" type="xs:positiveInteger"/>
    </xs:choice>
    <xs:attribute name="interval" type="priceInterval" use="optional"/>
    <xs:attribute name="referring" type="priceReferring" use="optional"/>
  </xs:complexType>
</xs:element>

possible solution nr 2 (i guess this would disallow only specifying extra by itself)

<xs:element maxOccurs="1" minOccurs="0" name="rent">
  <xs:complexType>
    <xs:choice>
      <xs:all>
          <xs:element maxOccurs="1" minOccurs="1" name="gross" type="xs:positiveInteger"/>
          <xs:element maxOccurs="1" minOccurs="1" name="net" type="xs:positiveInteger"/>
          <xs:element maxOccurs="1" minOccurs="0" name="extra" type="xs:positiveInteger"/>
      </xs:all>
      <xs:all>
         <xs:element maxOccurs="1" minOccurs="1" name="gross" type="xs:positiveInteger"/>
         <xs:element maxOccurs="1" minOccurs="0" name="extra" type="xs:positiveInteger"/>
      </xs:all>
      <xs:all>
         <xs:element maxOccurs="1" minOccurs="1" name="net" type="xs:positiveInteger"/>
         <xs:element maxOccurs="1" minOccurs="0" name="extra" type="xs:positiveInteger"/>
      </xs:all>
     <xs:element name="Elem3" />
    </xs:choice>
    <xs:attribute name="interval" type="priceInterval" use="optional"/>
    <xs:attribute name="referring" type="priceReferring" use="optional"/>
  </xs:complexType>
</xs:element>