-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgnucash-v2.rnc
607 lines (502 loc) · 19.9 KB
/
gnucash-v2.rnc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
# Aug 2012: A RELAX NG Compact schema for gnucash "v2" XML files.
# Copyright (C) 2006 Joshua Sled <[email protected]>
# Copyright (C) 2012 Baptiste Carvello <[email protected]>
# This schema is non-normative; files emitted by gnucash <= 2.0 (and perhaps
# later) that do not validate against it likely represent a problem with the
# schema, not the file. The schema was last updated for gnucash trunk, rev 22330.
# http://relaxng.org/compact-tutorial-20030326.html
# from write_v2_header in src/backend/xml/io-gncxml-v2.c
# as per gnucash/LICENSE, this file is licensed under GPL Version 2,
# or (at your option) Version 3.
namespace gnc = "http://www.gnucash.org/XML/gnc"
namespace act = "http://www.gnucash.org/XML/act"
namespace book = "http://www.gnucash.org/XML/book"
namespace cd = "http://www.gnucash.org/XML/cd"
namespace cmdty = "http://www.gnucash.org/XML/cmdty"
namespace price = "http://www.gnucash.org/XML/price"
namespace slot = "http://www.gnucash.org/XML/slot"
namespace split = "http://www.gnucash.org/XML/split"
namespace sx = "http://www.gnucash.org/XML/sx"
namespace trn = "http://www.gnucash.org/XML/trn"
namespace ts = "http://www.gnucash.org/XML/ts"
namespace fs = "http://www.gnucash.org/XML/fs"
namespace bgt = "http://www.gnucash.org/XML/bgt"
namespace recurrence = "http://www.gnucash.org/XML/recurrence"
namespace lot = "http://www.gnucash.org/XML/lot"
# plugins, in order (address, owner, bill-term, customer, employee, entry, invoice,
# job, order, tax-table, vendor)
namespace addr = "http://www.gnucash.org/XML/addr"
namespace owner = "http://www.gnucash.org/XML/owner"
namespace billterm = "http://www.gnucash.org/XML/billterm"
namespace bt-days = "http://www.gnucash.org/XML/bt-days"
namespace bt-prox = "http://www.gnucash.org/XML/bt-prox"
namespace cust = "http://www.gnucash.org/XML/cust"
namespace employee = "http://www.gnucash.org/XML/employee"
namespace entry = "http://www.gnucash.org/XML/entry"
namespace invoice = "http://www.gnucash.org/XML/invoice"
namespace job = "http://www.gnucash.org/XML/job"
namespace order = "http://www.gnucash.org/XML/order"
namespace taxtable = "http://www.gnucash.org/XML/taxtable"
namespace tte = "http://www.gnucash.org/XML/tte"
namespace vendor = "http://www.gnucash.org/XML/vendor"
start = element gnc:gnc-v2 {
# from gnc_book_write_to_xml_filehandle_v2 in src/backend/xml/io-gncxml-v2.c
CountData,
(
Book | ( Commodity*, Account* )
)
}
# from write_book in src/backend/xml/io-gncxml-v2.c
CountData = element gnc:count-data {
( attribute cd:type { "book" } |
attribute cd:type { "commodity" } |
attribute cd:type { "account" } |
attribute cd:type { "transaction" } |
attribute cd:type { "schedxaction" } |
attribute cd:type { "budget" } |
# plugins (those with a get_count slot)
attribute cd:type { "gnc:GncBillTerm" } |
attribute cd:type { "gnc:GncCustomer" } |
attribute cd:type { "gnc:GncEmployee" } |
attribute cd:type { "gnc:GncEntry" } |
attribute cd:type { "gnc:GncInvoice" } |
attribute cd:type { "gnc:GncJob" } |
attribute cd:type { "gnc:GncOrder" } |
attribute cd:type { "gnc:GncTaxTable" } |
attribute cd:type { "gnc:GncVendor" } ),
xsd:int }
# from write_book in src/backend/xml/io-gncxml-v2.c
Book = element gnc:book {
attribute version { "2.0.0" },
# from write_book_parts in src/backend/xml/gnc-book-xml-v2.c
element book:id { attribute type { "guid" }, GUID },
element book:slots { KvpSlot+ }?,
# from write_book in src/backend/xml/io-gncxml-v2.c
CountData*,
Commodity*,
PriceDb?,
Account*,
Transaction*,
TemplateTransactions*,
ScheduledTransaction*,
Budget*,
# plugins (those with a write slot)
BillTerm*,
Customer*,
Employee*,
Entry*,
Invoice*,
Job*,
Order*,
TaxTable*,
Vendor*
}
# from src/backend/xml/sixtp-dom-generators.c
KvpSlot = element slot {
element slot:key { text },
KvpValue
}
KvpValue = ( element slot:value { (
( attribute type { "integer" }, xsd:int )
| ( attribute type { "double" }, xsd:double )
| ( attribute type { "numeric" }, GncNumeric )
| ( attribute type { "string" }, text )
| ( attribute type { "guid" }, GUID )
| ( attribute type { "timespec" }, TimeSpec )
| ( attribute type { "gdate" }, GDate )
| ( attribute type { "binary" }, xsd:string { pattern = "[0-9a-f]*" } )
| ( attribute type { "list" }, KvpValue* )
| ( attribute type { "frame" }, KvpSlot* )
) }
)
# various patterns
GncNumeric = xsd:string { pattern = "-?[0-9]+/-?[0-9]+" }
GUID = xsd:string { pattern = "[0-9a-f]{32}" }
TimeSpec = ( TimeStamp,
element ts:ns { xsd:int }?
)
TimeStamp = element ts:date { xsd:string { pattern = "[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} (\+|-)[0-9]{4}" } }
GDate = element gdate { xsd:string { pattern = "[0-9]{4}-[0-9]{2}-[0-9]{2}" } }
# from gnc_commodity_dom_tree_create in src/backend/xml/gnc-commodity-xml-v2.c
Commodity = element gnc:commodity {
attribute version { "2.0.0" },
( ( element cmdty:space { text }, # catégorie (monnaies)
element cmdty:id { text }, # dénomination
element cmdty:name { text }?,
element cmdty:xcode { text }?,
element cmdty:fraction { text }?
)
),
( element cmdty:get_quotes { empty },
element cmdty:quote_source { text }?,
element cmdty:quote_tz { text | empty }?
)?,
element cmdty:slots { KvpSlot+ }?
}
# from gnc_pricedb_to_dom_tree in src/backend/xml/gnc-pricedb-xml-v2.c
PriceDb = element gnc:pricedb {
attribute version { "1" },
Price+
}
# from gnc_price_to_dom_tree in src/backend/xml/gnc-pricedb-xml-v2.c
Price = element price {
element price:id { attribute type { "guid" }, GUID },
element price:commodity {
element cmdty:space { text },
element cmdty:id { text }
},
element price:currency {
element cmdty:space { text },
element cmdty:id { text }
},
element price:time { TimeSpec },
element price:source { text }?,
# from the doc string of gnc_price_class_init in src/engine/gnc-pricedb.c
element price:type { "bid" | "ask" | "last" | "nav" | "unknown" }?,
element price:value { GncNumeric }
}
# from gnc_account_dom_tree_create in src/backend/xml/gnc-account-xml-v2.c
Account = element gnc:account {
attribute version { "2.0.0" },
element act:name { text },
element act:id { attribute type { "guid" }, GUID },
# from xaccAccountTypeEnumAsString in src/engine/Account.c
element act:type { "NONE"
| "BANK"
| "CASH"
| "CREDIT"
| "ASSET"
| "LIABILITY"
| "STOCK"
| "MUTUAL"
| "CURRENCY"
| "INCOME"
| "EXPENSE"
| "EQUITY"
| "RECEIVABLE"
| "PAYABLE"
| "ROOT"
| "TRADING"
| "CHECKING"
| "SAVINGS"
| "MONEYMRKT"
| "CREDITLINE" },
( element act:commodity {
element cmdty:space { text },
element cmdty:id { text }
},
element act:commodity-scu { xsd:int },
element act:non-standard-scu { empty }?
)?,
element act:code { text }?,
element act:description { text }?,
element act:slots { KvpSlot+ }?,
element act:parent { attribute type { "guid" }, GUID }?,
element act:lots { Lot+ }?
}
# from gnc_lot_dom_tree_create in src/backend/xml/gnc-lot-xml-v2.c
Lot = element gnc:lot {
attribute version { "2.0.0" },
element lot:id { attribute type { "guid" }, GUID },
element lot:slots { KvpSlot+ }
}
# from gnc_transaction_dom_tree_create in src/backend/xml/gnc-transaction-xml-v2.c
Transaction = element gnc:transaction {
attribute version { "2.0.0" },
element trn:id { attribute type { "guid" }, GUID },
element trn:currency {
element cmdty:space { text },
element cmdty:id { text }
},
element trn:num { text }?,
element trn:date-posted { TimeSpec },
element trn:date-entered { TimeSpec },
element trn:description { text }?,
element trn:slots { KvpSlot+ }?,
element trn:splits { Split+ }
}
# from split_to_dom_tree in src/backend/xml/gnc-transaction-xml-v2.c
Split = element trn:split {
element split:id { attribute type { "guid" }, GUID },
element split:memo { text }?,
element split:action { text }?,
# from defines in src/engine/Split.h
element split:reconciled-state { "y" | "n" | "c" | "f" | "v" },
element split:reconcile-date { TimeSpec }?,
element split:value { GncNumeric },
element split:quantity { GncNumeric },
element split:account { attribute type { "guid" }, GUID },
element split:lot { attribute type { "guid" }, GUID }?,
element split:slots { KvpSlot+ }?
}
# from write_template_transaction_data in src/backend/xml/io-gncxml-v2.c
TemplateTransactions = element gnc:template-transactions {
Account*,
Transaction*
}
# from gnc_schedXaction_dom_tree_create in src/backend/xml/gnc-schedxaction-xml-v2.c
ScheduledTransaction = element gnc:schedxaction {
attribute version { "2.0.0" },
element sx:id { attribute type { "guid" }, GUID },
element sx:name { text },
element sx:enabled { "y" | "n" },
element sx:autoCreate { "y" | "n" },
element sx:autoCreateNotify { "y" | "n" },
element sx:advanceCreateDays { xsd:int },
element sx:advanceRemindDays { xsd:int },
element sx:instanceCount { xsd:int },
element sx:start { GDate },
element sx:last { GDate }?,
( ( element sx:num-occur { xsd:int },
element sx:rem-occur { xsd:int }
)
| element sx:end { GDate }
)?,
element sx:templ-acct { attribute type { "guid" }, GUID },
element sx:schedule {
element gnc:recurrence { RecurrenceContent }*
},
DeferredInstance*,
element sx:slots { KvpSlot+ }?
}
DeferredInstance = element sx:deferredInstance {
element sx:last { GDate }?,
element sx:rem-occur { xsd:int },
element sx:instanceCount { xsd:int }
}
# from recurrence_to_dom_tree in src/backend/xml/gnc-recurrence-xml-v2.c
RecurrenceContent = (
attribute version { "1.0.0" },
element recurrence:mult { xsd:int },
# from a static array in src/engine/Recurrence.c
element recurrence:period_type { "once"
| "day"
| "week"
| "month"
| "end of month"
| "nth weekday"
| "last weekday"
| "year" },
element recurrence:start { GDate },
element recurrence:weekend_adj { "none"
| "back"
| "forward" }?
)
# from gnc_budget_dom_tree_create in src/backend/xml/gnc-budget-xml-v2.c
Budget = element gnc:budget {
attribute version { "2.0.0" },
element bgt:id { attribute type { "guid" }, GUID },
element bgt:name { text },
element bgt:description { text },
element bgt:num-periods { xsd:int },
element bgt:recurrence { RecurrenceContent },
element bgt:slots { KvpSlot+ }?
}
# from in src/backend/xml/gnc-bill-term-xml-v2.c
BillTerm = element gnc:GncBillTerm {
attribute version { "2.0.0" },
element billterm:guid { attribute type { "guid" }, GUID }?,
element billterm:name { text },
element billterm:desc { text },
element billterm:refcount { xsd:int },
element billterm:invisible { xsd:boolean { pattern = "[01]" } },
element billterm:slots { KvpSlot+ }?,
element billterm:child { attribute type { "guid" }, GUID }?,
element billterm:parent { attribute type { "guid" }, GUID }?,
( element billterm:days {
element bt-days:due-days { xsd:int }?,
element bt-days:disc-days { xsd:int }?,
element bt-days:discount { GncNumeric }?
}
| element billterm:proximo {
element bt-prox:due-day { xsd:int }?,
element bt-prox:disc-day { xsd:int }?,
element bt-prox:discount { GncNumeric }?,
element bt-prox:cutoff-day { xsd:int }?
}
)
}
# from customer_dom_tree_create in src/backend/xml/gnc-customer-xml-v2.c
Customer = element gnc:GncCustomer {
attribute version { "2.0.0" },
element cust:guid { attribute type { "guid" }, GUID },
element cust:name { text },
element cust:id { text },
element cust:addr { AddressContent },
element cust:shipaddr { AddressContent },
element cust:notes { text }?,
element cust:terms { attribute type { "guid" }, GUID }?,
# from gncTaxIncludedTypeToString in src/engine/gncTaxTable.c
element cust:taxincluded { "YES" | "NO" | "USEGLOBAL"},
element cust:active { xsd:boolean { pattern = "[01]" } },
element cust:discount { GncNumeric },
element cust:credit { GncNumeric },
element cust:currency {
element cmdty:space { text },
element cmdty:id { text }
},
element cust:use-tt { xsd:boolean { pattern = "[01]" } },
element cust:taxtable { attribute type { "guid" }, GUID }?,
element cust:slots { KvpSlot+ }?
}
# from gnc_address_to_dom_tree in src/backend/xml/gnc-address-xml-v2.c
AddressContent = (
attribute version { "2.0.0" },
( empty
| ( element addr:name { text }?,
element addr:addr1 { text }?,
element addr:addr2 { text }?,
element addr:addr3 { text }?,
element addr:addr4 { text }?,
element addr:phone { text }?,
element addr:fax { text }?,
element addr:email { text }?
)
)
)
# from employee_dom_tree_create in src/backend/xml/gnc-employee-xml-v2.c
Employee = element gnc:GncEmployee {
attribute version { "2.0.0" },
element employee:guid { attribute type { "guid" }, GUID },
element employee:username { text },
element employee:id { text },
element employee:addr { AddressContent },
element employee:language { text }?,
element employee:acl { text }?,
element employee:active { xsd:boolean { pattern = "[01]" } },
element employee:workday { GncNumeric },
element employee:rate { GncNumeric },
element employee:currency {
element cmdty:space { text },
element cmdty:id { text }
},
element employee:ccard { attribute type { "guid" }, GUID }?,
element employee:slots { KvpSlot+ }?
}
# from entry_dom_tree_create in src/backend/xml/gnc-entry-xml-v2.c
Entry = element gnc:GncEntry {
attribute version { "2.0.0" },
element entry:guid { attribute type { "guid" }, GUID },
element entry:date { TimeSpec },
element entry:entered { TimeSpec },
element entry:description { text }?,
element entry:action { text }?,
element entry:notes { text }?,
element entry:qty { GncNumeric }?,
element entry:i-acct { attribute type { "guid" }, GUID }?,
element entry:i-price { GncNumeric }?,
element entry:i-discount { GncNumeric }?,
( element entry:invoice { attribute type { "guid" }, GUID },
# from gncAmountTypeToString in src/engine/gncTaxTable.c
element entry:i-disc-type { "VALUE" | "PERCENT" },
# from gncEntryDiscountHowToString in src/engine/gncEntry.c
element entry:i-disc-how { "PRETAX" | "POSTTAX" | "SAMETIME" },
element entry:i-taxable { xsd:boolean { pattern = "[01]" } },
element entry:i-taxincluded { xsd:boolean { pattern = "[01]" } }
)?,
element entry:i-taxtable { attribute type { "guid" }, GUID }?,
element entry:b-acct { attribute type { "guid" }, GUID }?,
element entry:b-price { GncNumeric }?,
( element entry:bill { attribute type { "guid" }, GUID },
element entry:billable { xsd:boolean { pattern = "[01]" } },
element entry:billto { OwnerContent }?,
element entry:b-taxable { xsd:boolean { pattern = "[01]" } },
element entry:b-taxincluded { xsd:boolean { pattern = "[01]" } },
# from gncEntryPaymentTypeToString in src/engine/gncEntry.c
element entry:b-pay { "CASH" | "CARD" }?
)?,
element entry:b-taxtable { attribute type { "guid" }, GUID }?,
element entry:order { attribute type { "guid" }, GUID }?
}
# from gnc_owner_to_dom_tree in src/backend/xml/gnc-owner-xml-v2.c
OwnerContent = (
attribute version { "2.0.0" },
element owner:type { "gncCustomer"
| "gncJob"
| "gncVendor"
| "gncEmployee" },
element owner:id { attribute type { "guid" }, GUID }
)
# from invoice_dom_tree_create in src/backend/xml/gnc-invoice-xml-v2.c
Invoice = element gnc:GncInvoice {
attribute version { "2.0.0" },
element invoice:guid { attribute type { "guid" }, GUID },
element invoice:id { text },
element invoice:owner { OwnerContent },
element invoice:opened { TimeSpec },
element invoice:posted { TimeSpec }?,
element invoice:terms { attribute type { "guid" }, GUID }?,
element invoice:billing_id { text }?,
element invoice:notes { text }?,
element invoice:active { xsd:boolean { pattern = "[01]" } },
element invoice:posttxn { attribute type { "guid" }, GUID }?,
element invoice:postlot { attribute type { "guid" }, GUID }?,
element invoice:postacc { attribute type { "guid" }, GUID }?,
element invoice:currency {
element cmdty:space { text },
element cmdty:id { text }
},
element invoice:billto { OwnerContent }?,
element invoice:charge-amt { GncNumeric }?,
element invoice:slots { KvpSlot+ }?
}
# from job_dom_tree_create in src/backend/xml/gnc-job-xml-v2.c
Job = element gnc:GncJob {
attribute version { "2.0.0" },
element job:guid { attribute type { "guid" }, GUID },
element job:id { text },
element job:name { text },
element job:reference { text }?,
element job:owner { OwnerContent },
element job:active { xsd:boolean { pattern = "[01]" } }
}
# from order_dom_tree_create in src/backend/xml/gnc-order-xml-v2.c
Order = element gnc:GncOrder {
attribute version { "2.0.0" },
element order:guid { attribute type { "guid" }, GUID },
element order:id { text },
element order:owner { OwnerContent },
element order:opened { TimeSpec },
element order:closed { TimeSpec }?,
element order:notes { text }?,
element order:reference { text }?,
element order:active { xsd:boolean { pattern = "[01]" } }
}
# from taxtable_dom_tree_create in src/backend/xml/gnc-tax-table-xml-v2.c
TaxTable = element gnc:GncTaxTable {
attribute version { "2.0.0" },
element taxtable:guid { attribute type { "guid" }, GUID }?,
element taxtable:name { text },
element taxtable:refcount { xsd:int },
element taxtable:invisible { xsd:boolean { pattern = "[01]" } },
element taxtable:child { attribute type { "guid" }, GUID }?,
element taxtable:parent { attribute type { "guid" }, GUID }?,
element taxtable:entries { TaxTableEntry* }
}
# from ttentry_dom_tree_create in src/backend/xml/gnc-tax-table-xml-v2.c
TaxTableEntry = element gnc:GncTaxTableEntry {
element tte:acct { attribute type { "guid" }, GUID }?,
element tte:amount { GncNumeric },
# from gncAmountTypeToString in src/engine/gncTaxTable.c
element tte:type { "VALUE" | "PERCENT" }
}
# from vendor_dom_tree_create in src/backend/xml/gnc-vendor-xml-v2.c
Vendor = element gnc:GncVendor {
attribute version { "2.0.0" },
element vendor:guid { attribute type { "guid" }, GUID },
element vendor:name { text },
element vendor:id { text },
element vendor:addr { AddressContent },
element vendor:notes { text }?,
element vendor:terms { attribute type { "guid" }, GUID }?,
# from gncTaxIncludedTypeToString in src/engine/gncTaxTable.c
element vendor:taxincluded { "YES" | "NO" | "USEGLOBAL"},
element vendor:active { xsd:boolean { pattern = "[01]" } },
element vendor:currency {
element cmdty:space { text },
element cmdty:id { text }
},
element vendor:use-tt { xsd:boolean { pattern = "[01]" } },
element vendor:taxtable { attribute type { "guid" }, GUID }?,
element vendor:slots { KvpSlot+ }?
}