<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
  <define name="tree">
    <element name="tree">
      <ref name="attlist.tree"/>
      <zeroOrMore>
        <choice>
          <ref name="field"/>
          <ref name="button"/>
        </choice>
      </zeroOrMore>
    </element>
  </define>
  <define name="attlist.tree" combine="interleave">
    <optional>
      <attribute name="string" a:defaultValue="Unknown"/>
    </optional>
  </define>
  <define name="attlist.tree" combine="interleave">
    <optional>
      <attribute name="on_write"/>
    </optional>
  </define>
  <define name="attlist.tree" combine="interleave">
    <optional>
      <attribute name="editable">
        <choice>
          <value>top</value>
          <value>bottom</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <define name="attlist.tree" combine="interleave">
    <optional>
      <attribute name="sequence"/>
    </optional>
  </define>
  <define name="attlist.tree" combine="interleave">
    <optional>
      <attribute name="colors"/>
    </optional>
  </define>
  <define name="attlist.tree" combine="interleave">
    <optional>
      <attribute name="keyword_open" a:defaultValue="0">
        <choice>
          <value>0</value>
          <value>1</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <define name="field">
    <element name="field">
      <ref name="attlist.field"/>
      <empty/>
    </element>
  </define>
  <define name="attlist.field" combine="interleave">
    <attribute name="name"/>
  </define>
  <define name="attlist.field" combine="interleave">
    <optional>
      <attribute name="readonly">
        <choice>
          <value>0</value>
          <value>1</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <define name="attlist.field" combine="interleave">
    <optional>
      <attribute name="widget">
        <choice>
          <value>char</value>
          <value>many2one</value>
          <value>date</value>
          <value>one2many</value>
          <value>selection</value>
          <value>float</value>
          <value>numeric</value>
          <value>float_time</value>
          <value>integer</value>
          <value>datetime</value>
          <value>boolean</value>
          <value>text</value>
          <value>url</value>
          <value>email</value>
          <value>callto</value>
          <value>sip</value>
          <value>progressbar</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <define name="attlist.field" combine="interleave">
    <optional>
      <attribute name="tree_invisible" a:defaultValue="0">
        <choice>
          <value>0</value>
          <value>1</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <define name="attlist.field" combine="interleave">
    <optional>
      <attribute name="expand" a:defaultValue="0">
        <choice>
          <value>0</value>
          <value>1</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <define name="attlist.field" combine="interleave">
    <optional>
      <attribute name="icon"/>
    </optional>
  </define>
  <define name="attlist.field" combine="interleave">
    <optional>
      <attribute name="sum"/>
    </optional>
  </define>
  <define name="attlist.field" combine="interleave">
    <optional>
      <attribute name="width"/>
    </optional>
  </define>
  <define name="attlist.field" combine="interleave">
    <optional>
      <attribute name="orientation" a:defaultValue="left_to_right">
        <choice>
          <value>left_to_right</value>
          <value>right_to_left</value>
          <value>bottom_to_top</value>
          <value>top_to_bottom</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <define name="attlist.field" combine="interleave">
    <optional>
      <attribute name="float_time"/>
    </optional>
  </define>
  <define name="button">
    <element name="button">
      <ref name="attlist.button"/>
      <empty/>
    </element>
  </define>
  <define name="attlist.button" combine="interleave">
    <optional>
      <attribute name="help"/>
    </optional>
  </define>
  <define name="attlist.button" combine="interleave">
    <optional>
      <attribute name="string" a:defaultValue="Unknown"/>
    </optional>
  </define>
  <define name="attlist.button" combine="interleave">
    <optional>
      <attribute name="type" a:defaultValue="object">
        <choice>
          <value>object</value>
          <value>action</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <define name="attlist.button" combine="interleave">
    <optional>
      <attribute name="confirm"/>
    </optional>
  </define>
  <define name="attlist.button" combine="interleave">
    <attribute name="name"/>
  </define>
  <define name="attlist.button" combine="interleave">
    <optional>
      <attribute name="states"/>
    </optional>
  </define>
  <define name="data">
    <element name="data">
      <ref name="attlist.data"/>
      <oneOrMore>
        <ref name="xpath"/>
      </oneOrMore>
    </element>
  </define>
  <define name="attlist.data" combine="interleave">
    <empty/>
  </define>
  <define name="xpath">
    <element name="xpath">
      <ref name="attlist.xpath"/>
      <zeroOrMore>
        <choice>
          <ref name="field"/>
          <ref name="button"/>
          <ref name="tree"/>
        </choice>
      </zeroOrMore>
    </element>
  </define>
  <define name="attlist.xpath" combine="interleave">
    <attribute name="expr"/>
  </define>
  <define name="attlist.xpath" combine="interleave">
    <optional>
      <attribute name="position" a:defaultValue="inside">
        <choice>
          <value>inside</value>
          <value>replace</value>
          <value>replace_attributes</value>
          <value>after</value>
          <value>before</value>
        </choice>
      </attribute>
    </optional>
  </define>
  <start>
    <choice>
      <ref name="tree"/>
      <ref name="data"/>
    </choice>
  </start>
</grammar>
