Example of simple address data

This example describes simple address data, where the fields can be in a different order, depending on the tag. The 'choice' tag determines the input line by matching based on the label.

Example input

name: John & Paul
number: 07593 128912
street: 1 Cousins Drive
name: P J Baird
street: 24b The Hamptons
number: 07382 213 877

Example output

<addresses>
  <address>
    <name>John &amp; Paul</name>
    <number>07593 128912</number>
    <street>1 Cousins Drive</street>
  </address>
  <address>
    <name>P J Baird</name>
    <street>24b The Hamptons</street>
    <number>07382 213 877</number>
  </address>
</addresses>

Schema

<?xml version='1.0'?>
<schema xmlns='http://www.infor.com/2017/TD/SSTransform/fsd/' version='1.0'>
  <sequence name="addresses">
    <sequence name="address" output="yes" max-occur="0" min-occur="0">
      <choice output="no" max-occur="3" min-occur="3">
        <record record-sep="\r\n" min-occur="1" output="no">
          <field name="name-label" min-length="6" max-length="6" valid-value="name: " output="no"/>
          <field name="name"/>
        </record>
        <record record-sep="\r\n" min-occur="1" output="no">
          <field name="addr-label" min-length="8" max-length="8" valid-value="street: " output="no"/>
          <field name="street"/>
        </record>
        <record record-sep="\r\n" min-occur="1" output="no">
          <field name="num-label" min-length="8" max-length="8" valid-value="number: " output="no"/>
          <field name="number"/>
        </record>
      </choice>
      <record name="blank-link" output="no" max-occur="1" min-occur="0" record-sep="\r\n">
        <field output="no"/>
      </record>
    </sequence>
  </sequence>
</schema>