The error message
"Element odoo has extra content: data"
may be generated if an xml file such as a view fails to validate against the RELAXNG schema file odoo/odoo/import_xml.rng. Unforunately it isn't very specific. For example, this file:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="record_id" model="ir.ui.view">
<field name="name">foo.bar.form</field>
<field name="model">baz.model</field>
<field name="arch" type="xml">
<form string="My Form">
<sheet>
<group>
<field name="my_field"/>
</group>
</sheet>
</form>
</field>
</record>
<act_window id="action_quux" name="My Action" res_model="baz.model" view_model="form"/>
</data>
</odoo>
will generate the message when validated, but there is no indication that the specific problem is that view_model should be view_mode. Is there a way to get a better error message?
The error message, at least on Debian Linux, is produced by LXML's RelaxNG validator, which in turn relies on libxml2. We can see that xmllint, also based on
libxml2, produces the same output:We can't easily change how Odoo is validating XML files, but we can install a different validator, jing, and use that to validate our file in the terminal.
To install (on Debian-based systems):
Once installed, call it like this and review the more detailed error message (formatted for readability):
Since Odoo 13, there is optional support for using the jingtrang package to generate jing's validation error messages in Odoo itself. To enable this support, install the jingtrang module from pypi.