enonic / xp

Enonic XP
https://enonic.com
GNU General Public License v3.0
201 stars 34 forks source link

xmlns in <site ...> (site.xml) forces <x-data ...> elements to be before the opening <form> element. #8501

Closed espen42 closed 3 years ago

espen42 commented 3 years ago

Using xmlns="urn:enonic:xp:model:1.0" inside the <site ...> opening element in site.xml enforces the order of the x-data element(s) within, it seems to only work if placed before <form>. This conflicts with recommendations in other docs.

For example (collapsed code content for clarity, in the <form> and <mappings> elements):

image ...works, while... image (1) ...does not.

If the xmlns part is removed, the order doesn't cause any IDE warning or runtime error.

This is not just a linting thing. When marked red as above, it builds just fine, but then, when editing the site in Content Studio, a wild runtime error appears:

image (2)

espen42 commented 3 years ago

First seen in app-superhero-blog when adding lib-menu. Reproduced by @poi33 in the enonic.com app.

rymsha commented 3 years ago

There are multiple x-data elements allowed according to schema:

  <xs:complexType name="site">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" name="x-data" type="xdata"/>
      <xs:element minOccurs="0" name="form" type="form"/>
      <xs:element minOccurs="0" name="processors" type="processors"/>
      <xs:element minOccurs="0" name="mappings" type="mappings"/>
    </xs:sequence>
  </xs:complexType>

And as soon as you are done specifying x-data elements you may specify form.

This is how things are. If documentation suggests different, let's fix the documentation.