- From: Steven Pemberton <steven.pemberton@cwi.nl>
- Date: Fri, 17 Jan 2025 13:52:29 +0000
- To: XForms <public-xformsusers@w3.org>, ixml <public-ixml@w3.org>
- Message-Id: <1737119662163.2839052410.265525645@cwi.nl>
Just for fun I defined an ixml grammar for (a tiny subset of) XForms.
The input:
title: Example XForm
style: xform.css
model M
instance data data.xml
submission save put:data.xml replace:none
input name "What is your name?"
submit "OK"
The output
<html>
<head>
<title>Example XForm</title>
<link type='text/css' rel='stylesheet' href='xform.css'/>
<model id='M'>
<instance id='data' resource='data.xml'/>
<submission id='save' method='put' resource='data.xml'
replace='none'/>
</model>
</head>
<body>
<group>
<input ref='name'>
<label>What is your name?</label>
</input>
<submit>
<label>OK</label>
</submit>
</group>
</body>
</html>
The grammar
xform>html: form, content.
form>head: title, styling?, model*.
title: -"title:", -" "*, ~[" "; #a], ~[#a]+, -#a.
-styling: -"style:", s, (style; stylelink).
stylelink>link: csstype, cssrel, href.
style: csstype, css.
@csstype>type: +"text/css".
@cssrel>rel: +"stylesheet".
@href: -iri.
model: -"model", s, id, -#a, (instance; bind; submission; Action)+.
instance: -"instance", s, id, resource.
@resource: iri.
@id: IDREF, s.
Action: "action" {todo}.
bind: "bind" {todo}.
css: "css" {todo}.
submission: -"submission", s, id, (method, -":", resource)?, replace?.
@method: "get"; "put".
@replace: -"replace:", name.
content>body: group.
group: control*.
-control: input; submit {more}.
input: -"input", s, ref, label.
@ref: xpath.
label: string.
submit: -"submit", s, submissionid?, label?.
@submissionid>submission: -"submission:", id.
-xpath: ["[]/:"; L]+, s.
-string: -'"', ~['"']*, -'"', s.
-IDREF: [L]+.
-iri: ~[" "; #A]+, s.
-name: [L]+, s.
-s: -[" "; #a]*.
Steven
Received on Friday, 17 January 2025 13:52:35 UTC