1  <!ELEMENT gnc (version, defaults*, preferences*,
2                 ledger-data*, prices*, recurring-transactions*)>
3
4  <!-- top level elements -->
5  <!ELEMENT defaults ANY>
6  <!ELEMENT preferences ANY>
7  <!ELEMENT ledger-data (commodity*, account*, transaction*)>
8  <!ELEMENT prices ANY>
9  <!ELEMENT recurring-transactions ANY>
10
11
12  <!-- elements for ledger-data -->
13  <!ELEMENT version (#PCDATA)>
14  <!ELEMENT commodity (restore | new)>
15  <!-- used in two contexts.  As near toplevel account and as guid in -->
16  <!-- split for the account it's associated with -->
17  <!ELEMENT account ( #PCDATA | restore | new )*>
18  <!ELEMENT transaction (restore | new)>
19
20  <!ENTITY % commodity-restore
21            "( space, id, name, xcode?, fraction )">
22  <!ENTITY % account-restore
23            "( name, guid, type, currency, security?, slots?, parent? )">
24  <!ENTITY % transaction-restore
25            "( guid, num?, date-posted, date-entered, description?,
26             slots?, split+)">
27  <!ENTITY % combined-restores "%commodity-restore; | %account-restore; | %transaction-restore;">
28  <!ENTITY % commodity-type "(space, id)">
29  <!ENTITY % commodity-new "ANY">
30  <!ENTITY % account-new "ANY">
31  <!ENTITY % transaction-new "ANY">
32  <!ENTITY % combined-news "%commodity-new; | %account-new; | %transaction-new;">
33
34  <!ENTITY % slot-types
35            "string | integer | double | etc">
36  <!ELEMENT string (#PCDATA)>
37  <!ELEMENT integer (#PCDATA)>
38  <!ELEMENT double (#PCDATA)>
39  <!ELEMENT etc (#PCDATA)> <!-- placeholder for other slot types -->
40
41  <!ELEMENT parent (guid)>
42  <!ELEMENT space (#PCDATA)>
43  <!ELEMENT id (#PCDATA)>
44  <!ELEMENT name (#PCDATA)>
45  <!ELEMENT xcode (#PCDATA)>
46  <!ELEMENT fraction (#PCDATA)>
47
48  <!ELEMENT guid (#PCDATA)>
49  <!ELEMENT type (#PCDATA)>
50  <!ELEMENT security %commodity-type;>
51  <!ELEMENT currency %commodity-type;>
52  <!ELEMENT slots (s+)>
53
54  <!-- used in two contexts as item in slots list and as a date in -->
55  <!-- date-entered and date-posted. -->
56  <!ELEMENT s (#PCDATA | k | %slot-types;)+>
57
58  <!ELEMENT k (#PCDATA)>
59  <!ELEMENT num (#PCDATA)>
60  <!ELEMENT date-posted (s)>
61  <!ELEMENT ns (#PCDATA)>
62  <!ELEMENT date-entered (s, ns?)>
63
64  <!ELEMENT description (#PCDATA)>
65
66  <!ELEMENT split (guid, memo?, reconcile-state, reconcile-date?, value, quantity, account)>
67
68  <!ELEMENT reconcile-date (s)>
69
70  <!ELEMENT memo (#PCDATA)>
71  <!ELEMENT reconcile-state (#PCDATA)>
72  <!ELEMENT value (#PCDATA)>
73  <!ELEMENT quantity (#PCDATA)>
74
75  <!ELEMENT restore (%combined-restores;)>
76  <!ELEMENT new (%combined-news;)>
77
78