Core DevAlpha
XML xpath and eval cookbook
View inherit xpath
Supported expressions:
| Pattern | Example |
|---|---|
| Field by name | //field[@name='email'] |
| Button by name | //button[@name='action_confirm'] |
| Group/sheet/page by attribute | //group[@string='Identity'] |
| Tag only | //sheet |
| Class predicate | //group[hasclass('sum_contact_block')] |
| Index (1-based) | //field[@name='line_ids'][2] |
Positions: after, before, inside, replace, attributes.
<xpath expr="//field[@name='name']" position="after">
<field name="phone"/>
</xpath>
<xpath expr="//group[hasclass('contact')]" position="inside">
<field name="mobile"/>
</xpath>
<xpath expr="//button[@name='print']" position="attributes">
<attribute name="string">Print PDF</attribute>
</xpath>Arch groups= on fields is enforced server-side when serializing workspace JSON.
Data eval= subset
eval.SafeEval supports:
- Booleans:
True,False - Numbers and quoted strings
- Ref tuples:
(4, ref('module.xml_id'))andref('module.xml_id') - Domain lists:
[('active', '=', True), ('state', 'in', ['draft', 'done'])] - Time helpers:
time.today(),time.now()
Full Python expressions are not supported — use Go services for complex logic.
Multiple matches without a [n] index are an error. Add [1], [2], … (1-based) when the expression hits more than one node.
Tags the matcher understands: field, button, group, sheet, header, notebook, page, div, label, separator, filter, search, tree, list, form, kanban, section, document, report, title, table, row, p.
model= and inherit= cannot be set on the same struct. Add columns with model inheritance, then expose them with xpath.