spiegel-keyman/resources/standards-data/keylayout/dtd/keylayout.dtd
SabineSIL 882ede0c54
feat(developer): kmc-convert: new conversion .keylayout->kmn 😎 (#12564)
kmc-convert provides tooling to convert between various common keyboard
description file formats. Each conversion will be implemented in its
single, separate module (and each module will done in its own PR)

This PR will address the conversion **keylayout → kmn**

Co-authored-by: Marc Durdin <marc@durdin.net>
2026-08-18 15:16:02 +02:00

93 lines
No EOL
3.1 KiB
DTD

<!--
* Keyman is copyright (C) SIL Global. MIT License.
*
* Created by S. Schmitt on 2025-07-14
*
* This DTD describes a technical preview of Keylayout Data
*
* Unless otherwise specified we used TN 2056:
* https://developer.apple.com/library/archive/technotes/tn2056/_index.html#//apple_ref/doc/uid/DTS10003085-CH1-SUBSECTION7
*
* kmc-convert does not need and therefore does not process the following attributes:
* group, id, maxout,
* first, last, mapSet, modifiers,
* defaultIndex,
* baseMapSet, baseIndex,
* through, multiplier
* kmc-convert does not need and therefore does not process the following elements:
* terminators
* kmc-convert does not need and therefore does not process 'anonymous actions'
* -->
<!--
TN2056 has looser constraints in the DTD than the text of the TN, so we
tightened the quantifiers according to the descriptive text.
TN2056: <!ELEMENT keyboard (layouts+, modifierMap+, keyMapSet+, actions*, terminators*)>
-->
<!-- Overall structure -->
<!-- from TN 2056:
<!ELEMENT keyboard (layouts+, modifierMap+, keyMapSet+, actions*, terminators*)>
kmc-convert uses instead: -->
<!ELEMENT keyboard layouts>
<!ELEMENT keyboard modifierMap+>
<!ELEMENT keyboard keyMapSet+>
<!ELEMENT keyboard actions*>
<!ELEMENT keyboard terminators*>
<!ATTLIST keyboard group NMTOKEN #REQUIRED >
<!ATTLIST keyboard id NMTOKEN #REQUIRED >
<!ATTLIST keyboard name CDATA #REQUIRED >
<!ATTLIST keyboard maxout NMTOKEN #IMPLIED >
<!-- Hardware layout elements -->
<!ELEMENT layouts (layout+) >
<!ELEMENT layout EMPTY >
<!ATTLIST layout first NMTOKEN #REQUIRED >
<!ATTLIST layout last NMTOKEN #REQUIRED >
<!ATTLIST layout mapSet IDREF #REQUIRED >
<!ATTLIST layout modifiers IDREF #REQUIRED >
<!-- Modifier descriptions -->
<!ELEMENT modifierMap (keyMapSelect+) >
<!ATTLIST modifierMap id ID #REQUIRED >
<!ATTLIST modifierMap defaultIndex NMTOKEN #REQUIRED >
<!ELEMENT keyMapSelect (modifier+) >
<!ATTLIST keyMapSelect mapIndex NMTOKEN #REQUIRED >
<!ELEMENT modifier EMPTY >
<!ATTLIST modifier keys CDATA #REQUIRED >
<!-- Keyboard mapping most keyboards use ANSI only but some use JIS also -->
<!ELEMENT keyMapSet (keyMap+) >
<!ATTLIST keyMapSet id ID #REQUIRED >
<!ELEMENT keyMap (key+) >
<!ATTLIST keyMap index NMTOKEN #REQUIRED >
<!ATTLIST keyMap baseMapSet IDREF #IMPLIED >
<!ATTLIST keyMap baseIndex NMTOKEN #IMPLIED >
<!ELEMENT key (action*) >
<!ATTLIST key code NMTOKEN #REQUIRED >
<!-- from TN 2056:
<!ATTLIST key output CDATA #IMPLIED >
<!ATTLIST key action IDREF #IMPLIED >
since output or action needs to be present kmc-convert uses instead: -->
<!ATTLIST key (action #REQUIRED output #IMPLIED | output #REQUIRED action #IMPLIED)>
<!-- Actions (state records) -->
<!ELEMENT actions (action+) >
<!ELEMENT action (when+) >
<!ATTLIST action id ID #IMPLIED >
<!ELEMENT when EMPTY >
<!ATTLIST when state NMTOKEN #REQUIRED >
<!ATTLIST when through NMTOKEN #IMPLIED >
<!ATTLIST when output CDATA #IMPLIED >
<!ATTLIST when multiplier NMTOKEN #IMPLIED >
<!ATTLIST when next NMTOKEN #IMPLIED >
<!-- Terminators -->
<!-- kmc-convert does not use terminators -->
<!ELEMENT terminators (when+)>