[r2410]: trunk / contrib / lxml / subclasses.py Maximize Restore History

Download this file

subclasses.py    939 lines (697 with data), 34.0 kB

  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
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
#!/usr/bin/env python
#
# Generated Thu May 15 16:07:59 2014 by generateDS.py version 2.12d.
#
import sys
import ??? as supermod
etree_ = None
Verbose_import_ = False
(
XMLParser_import_none, XMLParser_import_lxml,
XMLParser_import_elementtree
) = range(3)
XMLParser_import_library = None
try:
# lxml
from lxml import etree as etree_
XMLParser_import_library = XMLParser_import_lxml
if Verbose_import_:
print("running with lxml.etree")
except ImportError:
try:
# cElementTree from Python 2.5+
import xml.etree.cElementTree as etree_
XMLParser_import_library = XMLParser_import_elementtree
if Verbose_import_:
print("running with cElementTree on Python 2.5+")
except ImportError:
try:
# ElementTree from Python 2.5+
import xml.etree.ElementTree as etree_
XMLParser_import_library = XMLParser_import_elementtree
if Verbose_import_:
print("running with ElementTree on Python 2.5+")
except ImportError:
try:
# normal cElementTree install
import cElementTree as etree_
XMLParser_import_library = XMLParser_import_elementtree
if Verbose_import_:
print("running with cElementTree")
except ImportError:
try:
# normal ElementTree install
import elementtree.ElementTree as etree_
XMLParser_import_library = XMLParser_import_elementtree
if Verbose_import_:
print("running with ElementTree")
except ImportError:
raise ImportError(
"Failed to import ElementTree from any known place")
def parsexml_(*args, **kwargs):
if (XMLParser_import_library == XMLParser_import_lxml and
'parser' not in kwargs):
# Use the lxml ElementTree compatible parser so that, e.g.,
# we ignore comments.
kwargs['parser'] = etree_.ETCompatXMLParser()
doc = etree_.parse(*args, **kwargs)
return doc
#
# Globals
#
ExternalEncoding = 'ascii'
#
# Data representation classes
#
class databaseSub(supermod.database):
def __init__(self, xmlns=None, header=None, name_formats=None, tags=None, events=None, people=None, families=None, citations=None, sources=None, places=None, objects=None, repositories=None, notes=None, bookmarks=None, namemaps=None):
super(databaseSub, self).__init__(xmlns, header, name_formats, tags, events, people, families, citations, sources, places, objects, repositories, notes, bookmarks, namemaps, )
supermod.database.subclass = databaseSub
# end class databaseSub
class headerSub(supermod.header):
def __init__(self, created=None, researcher=None, mediapath=None):
super(headerSub, self).__init__(created, researcher, mediapath, )
supermod.header.subclass = headerSub
# end class headerSub
class createdSub(supermod.created):
def __init__(self, date=None, version=None):
super(createdSub, self).__init__(date, version, )
supermod.created.subclass = createdSub
# end class createdSub
class researcherSub(supermod.researcher):
def __init__(self, resname=None, resaddr=None, reslocality=None, rescity=None, resstate=None, rescountry=None, respostal=None, resphone=None, resemail=None):
super(researcherSub, self).__init__(resname, resaddr, reslocality, rescity, resstate, rescountry, respostal, resphone, resemail, )
supermod.researcher.subclass = researcherSub
# end class researcherSub
class resnameSub(supermod.resname):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(resnameSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.resname.subclass = resnameSub
# end class resnameSub
class resaddrSub(supermod.resaddr):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(resaddrSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.resaddr.subclass = resaddrSub
# end class resaddrSub
class reslocalitySub(supermod.reslocality):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(reslocalitySub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.reslocality.subclass = reslocalitySub
# end class reslocalitySub
class rescitySub(supermod.rescity):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(rescitySub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.rescity.subclass = rescitySub
# end class rescitySub
class resstateSub(supermod.resstate):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(resstateSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.resstate.subclass = resstateSub
# end class resstateSub
class rescountrySub(supermod.rescountry):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(rescountrySub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.rescountry.subclass = rescountrySub
# end class rescountrySub
class respostalSub(supermod.respostal):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(respostalSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.respostal.subclass = respostalSub
# end class respostalSub
class resphoneSub(supermod.resphone):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(resphoneSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.resphone.subclass = resphoneSub
# end class resphoneSub
class resemailSub(supermod.resemail):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(resemailSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.resemail.subclass = resemailSub
# end class resemailSub
class mediapathSub(supermod.mediapath):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(mediapathSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.mediapath.subclass = mediapathSub
# end class mediapathSub
class peopleSub(supermod.people):
def __init__(self, default=None, home=None, person=None):
super(peopleSub, self).__init__(default, home, person, )
supermod.people.subclass = peopleSub
# end class peopleSub
class personSub(supermod.person):
def __init__(self, handle=None, id=None, change=None, priv=None, gender=None, name=None, eventref=None, lds_ord=None, objref=None, address=None, attribute=None, url=None, childof=None, parentin=None, personref=None, noteref=None, citationref=None, tagref=None):
super(personSub, self).__init__(handle, id, change, priv, gender, name, eventref, lds_ord, objref, address, attribute, url, childof, parentin, personref, noteref, citationref, tagref, )
supermod.person.subclass = personSub
# end class personSub
class genderSub(supermod.gender):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(genderSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.gender.subclass = genderSub
# end class genderSub
class nameSub(supermod.name):
def __init__(self, sort=None, alt=None, type_=None, display=None, priv=None, first=None, call=None, surname=None, suffix=None, title=None, nick=None, familynick=None, group=None, daterange=None, datespan=None, dateval=None, datestr=None, noteref=None, citationref=None):
super(nameSub, self).__init__(sort, alt, type_, display, priv, first, call, surname, suffix, title, nick, familynick, group, daterange, datespan, dateval, datestr, noteref, citationref, )
supermod.name.subclass = nameSub
# end class nameSub
class firstSub(supermod.first):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(firstSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.first.subclass = firstSub
# end class firstSub
class callSub(supermod.call):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(callSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.call.subclass = callSub
# end class callSub
class suffixSub(supermod.suffix):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(suffixSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.suffix.subclass = suffixSub
# end class suffixSub
class titleSub(supermod.title):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(titleSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.title.subclass = titleSub
# end class titleSub
class nickSub(supermod.nick):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(nickSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.nick.subclass = nickSub
# end class nickSub
class familynickSub(supermod.familynick):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(familynickSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.familynick.subclass = familynickSub
# end class familynickSub
class groupSub(supermod.group):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(groupSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.group.subclass = groupSub
# end class groupSub
class surnameSub(supermod.surname):
def __init__(self, connector=None, prefix=None, prim=None, derivation=None, valueOf_=None, mixedclass_=None, content_=None):
super(surnameSub, self).__init__(connector, prefix, prim, derivation, valueOf_, mixedclass_, content_, )
supermod.surname.subclass = surnameSub
# end class surnameSub
class childofSub(supermod.childof):
def __init__(self, hlink=None):
super(childofSub, self).__init__(hlink, )
supermod.childof.subclass = childofSub
# end class childofSub
class parentinSub(supermod.parentin):
def __init__(self, hlink=None):
super(parentinSub, self).__init__(hlink, )
supermod.parentin.subclass = parentinSub
# end class parentinSub
class personrefSub(supermod.personref):
def __init__(self, hlink=None, rel=None, priv=None, citationref=None, noteref=None):
super(personrefSub, self).__init__(hlink, rel, priv, citationref, noteref, )
supermod.personref.subclass = personrefSub
# end class personrefSub
class addressSub(supermod.address):
def __init__(self, priv=None, daterange=None, datespan=None, dateval=None, datestr=None, street=None, locality=None, city=None, county=None, state=None, country=None, postal=None, phone=None, noteref=None, citationref=None):
super(addressSub, self).__init__(priv, daterange, datespan, dateval, datestr, street, locality, city, county, state, country, postal, phone, noteref, citationref, )
supermod.address.subclass = addressSub
# end class addressSub
class streetSub(supermod.street):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(streetSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.street.subclass = streetSub
# end class streetSub
class localitySub(supermod.locality):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(localitySub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.locality.subclass = localitySub
# end class localitySub
class citySub(supermod.city):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(citySub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.city.subclass = citySub
# end class citySub
class countySub(supermod.county):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(countySub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.county.subclass = countySub
# end class countySub
class stateSub(supermod.state):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(stateSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.state.subclass = stateSub
# end class stateSub
class countrySub(supermod.country):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(countrySub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.country.subclass = countrySub
# end class countrySub
class postalSub(supermod.postal):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(postalSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.postal.subclass = postalSub
# end class postalSub
class phoneSub(supermod.phone):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(phoneSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.phone.subclass = phoneSub
# end class phoneSub
class familiesSub(supermod.families):
def __init__(self, family=None):
super(familiesSub, self).__init__(family, )
supermod.families.subclass = familiesSub
# end class familiesSub
class familySub(supermod.family):
def __init__(self, handle=None, id=None, change=None, priv=None, rel=None, father=None, mother=None, eventref=None, lds_ord=None, objref=None, childref=None, attribute=None, noteref=None, citationref=None, tagref=None):
super(familySub, self).__init__(handle, id, change, priv, rel, father, mother, eventref, lds_ord, objref, childref, attribute, noteref, citationref, tagref, )
supermod.family.subclass = familySub
# end class familySub
class fatherSub(supermod.father):
def __init__(self, hlink=None):
super(fatherSub, self).__init__(hlink, )
supermod.father.subclass = fatherSub
# end class fatherSub
class motherSub(supermod.mother):
def __init__(self, hlink=None):
super(motherSub, self).__init__(hlink, )
supermod.mother.subclass = motherSub
# end class motherSub
class childrefSub(supermod.childref):
def __init__(self, frel=None, hlink=None, mrel=None, priv=None, citationref=None, noteref=None):
super(childrefSub, self).__init__(frel, hlink, mrel, priv, citationref, noteref, )
supermod.childref.subclass = childrefSub
# end class childrefSub
class type_Sub(supermod.type_):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(type_Sub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.type_.subclass = type_Sub
# end class type_Sub
class relSub(supermod.rel):
def __init__(self, type_=None):
super(relSub, self).__init__(type_, )
supermod.rel.subclass = relSub
# end class relSub
class eventsSub(supermod.events):
def __init__(self, event=None):
super(eventsSub, self).__init__(event, )
supermod.events.subclass = eventsSub
# end class eventsSub
class eventSub(supermod.event):
def __init__(self, handle=None, id=None, change=None, priv=None, type_=None, daterange=None, datespan=None, dateval=None, datestr=None, place=None, cause=None, description=None, attribute=None, noteref=None, citationref=None, objref=None, tagref=None):
super(eventSub, self).__init__(handle, id, change, priv, type_, daterange, datespan, dateval, datestr, place, cause, description, attribute, noteref, citationref, objref, tagref, )
supermod.event.subclass = eventSub
# end class eventSub
class sourcesSub(supermod.sources):
def __init__(self, source=None):
super(sourcesSub, self).__init__(source, )
supermod.sources.subclass = sourcesSub
# end class sourcesSub
class sourceSub(supermod.source):
def __init__(self, handle=None, id=None, change=None, priv=None, stitle=None, sauthor=None, spubinfo=None, sabbrev=None, noteref=None, objref=None, srcattribute=None, reporef=None, tagref=None):
super(sourceSub, self).__init__(handle, id, change, priv, stitle, sauthor, spubinfo, sabbrev, noteref, objref, srcattribute, reporef, tagref, )
supermod.source.subclass = sourceSub
# end class sourceSub
class stitleSub(supermod.stitle):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(stitleSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.stitle.subclass = stitleSub
# end class stitleSub
class sauthorSub(supermod.sauthor):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(sauthorSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.sauthor.subclass = sauthorSub
# end class sauthorSub
class spubinfoSub(supermod.spubinfo):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(spubinfoSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.spubinfo.subclass = spubinfoSub
# end class spubinfoSub
class sabbrevSub(supermod.sabbrev):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(sabbrevSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.sabbrev.subclass = sabbrevSub
# end class sabbrevSub
class placesSub(supermod.places):
def __init__(self, placeobj=None):
super(placesSub, self).__init__(placeobj, )
supermod.places.subclass = placesSub
# end class placesSub
class placeobjSub(supermod.placeobj):
def __init__(self, handle=None, name=None, type_=None, id=None, change=None, priv=None, ptitle=None, code=None, alt_name=None, coord=None, placeref=None, location=None, objref=None, url=None, noteref=None, citationref=None, tagref=None):
super(placeobjSub, self).__init__(handle, name, type_, id, change, priv, ptitle, code, alt_name, coord, placeref, location, objref, url, noteref, citationref, tagref, )
supermod.placeobj.subclass = placeobjSub
# end class placeobjSub
class ptitleSub(supermod.ptitle):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(ptitleSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.ptitle.subclass = ptitleSub
# end class ptitleSub
class codeSub(supermod.code):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(codeSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.code.subclass = codeSub
# end class codeSub
class alt_nameSub(supermod.alt_name):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(alt_nameSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.alt_name.subclass = alt_nameSub
# end class alt_nameSub
class coordSub(supermod.coord):
def __init__(self, lat=None, long=None):
super(coordSub, self).__init__(lat, long, )
supermod.coord.subclass = coordSub
# end class coordSub
class locationSub(supermod.location):
def __init__(self, city=None, locality=None, parish=None, county=None, phone=None, state=None, street=None, country=None, postal=None):
super(locationSub, self).__init__(city, locality, parish, county, phone, state, street, country, postal, )
supermod.location.subclass = locationSub
# end class locationSub
class objectsSub(supermod.objects):
def __init__(self, object=None):
super(objectsSub, self).__init__(object, )
supermod.objects.subclass = objectsSub
# end class objectsSub
class objectSub(supermod.object):
def __init__(self, handle=None, id=None, change=None, priv=None, file=None, attribute=None, noteref=None, daterange=None, datespan=None, dateval=None, datestr=None, citationref=None, tagref=None):
super(objectSub, self).__init__(handle, id, change, priv, file, attribute, noteref, daterange, datespan, dateval, datestr, citationref, tagref, )
supermod.object.subclass = objectSub
# end class objectSub
class fileSub(supermod.file):
def __init__(self, src=None, mime=None, description=None, checksum=None):
super(fileSub, self).__init__(src, mime, description, checksum, )
supermod.file.subclass = fileSub
# end class fileSub
class repositoriesSub(supermod.repositories):
def __init__(self, repository=None):
super(repositoriesSub, self).__init__(repository, )
supermod.repositories.subclass = repositoriesSub
# end class repositoriesSub
class repositorySub(supermod.repository):
def __init__(self, handle=None, id=None, change=None, priv=None, rname=None, type_=None, address=None, url=None, noteref=None, tagref=None):
super(repositorySub, self).__init__(handle, id, change, priv, rname, type_, address, url, noteref, tagref, )
supermod.repository.subclass = repositorySub
# end class repositorySub
class rnameSub(supermod.rname):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(rnameSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.rname.subclass = rnameSub
# end class rnameSub
class notesSub(supermod.notes):
def __init__(self, note=None):
super(notesSub, self).__init__(note, )
supermod.notes.subclass = notesSub
# end class notesSub
class noteSub(supermod.note):
def __init__(self, handle=None, format=None, type_=None, id=None, change=None, priv=None, text=None, style=None, tagref=None):
super(noteSub, self).__init__(handle, format, type_, id, change, priv, text, style, tagref, )
supermod.note.subclass = noteSub
# end class noteSub
class textSub(supermod.text):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(textSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.text.subclass = textSub
# end class textSub
class styleSub(supermod.style):
def __init__(self, name=None, value=None, range_=None):
super(styleSub, self).__init__(name, value, range_, )
supermod.style.subclass = styleSub
# end class styleSub
class range_Sub(supermod.range_):
def __init__(self, start=None, end=None):
super(range_Sub, self).__init__(start, end, )
supermod.range_.subclass = range_Sub
# end class range_Sub
class tagsSub(supermod.tags):
def __init__(self, tag=None):
super(tagsSub, self).__init__(tag, )
supermod.tags.subclass = tagsSub
# end class tagsSub
class tagSub(supermod.tag):
def __init__(self, color=None, priority=None, handle=None, name=None, change=None):
super(tagSub, self).__init__(color, priority, handle, name, change, )
supermod.tag.subclass = tagSub
# end class tagSub
class citationsSub(supermod.citations):
def __init__(self, citation=None):
super(citationsSub, self).__init__(citation, )
supermod.citations.subclass = citationsSub
# end class citationsSub
class citationSub(supermod.citation):
def __init__(self, handle=None, id=None, change=None, priv=None, daterange=None, datespan=None, dateval=None, datestr=None, page=None, confidence=None, noteref=None, objref=None, srcattribute=None, sourceref=None, tagref=None):
super(citationSub, self).__init__(handle, id, change, priv, daterange, datespan, dateval, datestr, page, confidence, noteref, objref, srcattribute, sourceref, tagref, )
supermod.citation.subclass = citationSub
# end class citationSub
class bookmarksSub(supermod.bookmarks):
def __init__(self, bookmark=None):
super(bookmarksSub, self).__init__(bookmark, )
supermod.bookmarks.subclass = bookmarksSub
# end class bookmarksSub
class bookmarkSub(supermod.bookmark):
def __init__(self, target=None, hlink=None):
super(bookmarkSub, self).__init__(target, hlink, )
supermod.bookmark.subclass = bookmarkSub
# end class bookmarkSub
class namemapsSub(supermod.namemaps):
def __init__(self, map=None):
super(namemapsSub, self).__init__(map, )
supermod.namemaps.subclass = namemapsSub
# end class namemapsSub
class mapSub(supermod.map):
def __init__(self, type_=None, value=None, key=None):
super(mapSub, self).__init__(type_, value, key, )
supermod.map.subclass = mapSub
# end class mapSub
class name_formatsSub(supermod.name_formats):
def __init__(self, format=None):
super(name_formatsSub, self).__init__(format, )
supermod.name_formats.subclass = name_formatsSub
# end class name_formatsSub
class formatSub(supermod.format):
def __init__(self, active=None, number=None, fmt_str=None, name=None):
super(formatSub, self).__init__(active, number, fmt_str, name, )
supermod.format.subclass = formatSub
# end class formatSub
class daterangeSub(supermod.daterange):
def __init__(self, cformat=None, stop=None, dualdated=None, start=None, newyear=None, quality=None):
super(daterangeSub, self).__init__(cformat, stop, dualdated, start, newyear, quality, )
supermod.daterange.subclass = daterangeSub
# end class daterangeSub
class datespanSub(supermod.datespan):
def __init__(self, cformat=None, stop=None, dualdated=None, start=None, newyear=None, quality=None):
super(datespanSub, self).__init__(cformat, stop, dualdated, start, newyear, quality, )
supermod.datespan.subclass = datespanSub
# end class datespanSub
class datevalSub(supermod.dateval):
def __init__(self, cformat=None, val=None, type_=None, dualdated=None, newyear=None, quality=None):
super(datevalSub, self).__init__(cformat, val, type_, dualdated, newyear, quality, )
supermod.dateval.subclass = datevalSub
# end class datevalSub
class datestrSub(supermod.datestr):
def __init__(self, val=None):
super(datestrSub, self).__init__(val, )
supermod.datestr.subclass = datestrSub
# end class datestrSub
class citationrefSub(supermod.citationref):
def __init__(self, hlink=None):
super(citationrefSub, self).__init__(hlink, )
supermod.citationref.subclass = citationrefSub
# end class citationrefSub
class sourcerefSub(supermod.sourceref):
def __init__(self, hlink=None):
super(sourcerefSub, self).__init__(hlink, )
supermod.sourceref.subclass = sourcerefSub
# end class sourcerefSub
class eventrefSub(supermod.eventref):
def __init__(self, role=None, hlink=None, priv=None, attribute=None, noteref=None):
super(eventrefSub, self).__init__(role, hlink, priv, attribute, noteref, )
supermod.eventref.subclass = eventrefSub
# end class eventrefSub
class reporefSub(supermod.reporef):
def __init__(self, medium=None, callno=None, hlink=None, priv=None, noteref=None):
super(reporefSub, self).__init__(medium, callno, hlink, priv, noteref, )
supermod.reporef.subclass = reporefSub
# end class reporefSub
class noterefSub(supermod.noteref):
def __init__(self, hlink=None):
super(noterefSub, self).__init__(hlink, )
supermod.noteref.subclass = noterefSub
# end class noterefSub
class tagrefSub(supermod.tagref):
def __init__(self, hlink=None):
super(tagrefSub, self).__init__(hlink, )
supermod.tagref.subclass = tagrefSub
# end class tagrefSub
class pageSub(supermod.page):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(pageSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.page.subclass = pageSub
# end class pageSub
class confidenceSub(supermod.confidence):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(confidenceSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.confidence.subclass = confidenceSub
# end class confidenceSub
class attributeSub(supermod.attribute):
def __init__(self, type_=None, value=None, priv=None, citationref=None, noteref=None):
super(attributeSub, self).__init__(type_, value, priv, citationref, noteref, )
supermod.attribute.subclass = attributeSub
# end class attributeSub
class srcattributeSub(supermod.srcattribute):
def __init__(self, type_=None, value=None, priv=None):
super(srcattributeSub, self).__init__(type_, value, priv, )
supermod.srcattribute.subclass = srcattributeSub
# end class srcattributeSub
class placeSub(supermod.place):
def __init__(self, hlink=None):
super(placeSub, self).__init__(hlink, )
supermod.place.subclass = placeSub
# end class placeSub
class causeSub(supermod.cause):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(causeSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.cause.subclass = causeSub
# end class causeSub
class descriptionSub(supermod.description):
def __init__(self, valueOf_=None, mixedclass_=None, content_=None):
super(descriptionSub, self).__init__(valueOf_, mixedclass_, content_, )
supermod.description.subclass = descriptionSub
# end class descriptionSub
class urlSub(supermod.url):
def __init__(self, href=None, type_=None, description=None, priv=None):
super(urlSub, self).__init__(href, type_, description, priv, )
supermod.url.subclass = urlSub
# end class urlSub
class objrefSub(supermod.objref):
def __init__(self, hlink=None, priv=None, region=None, attribute=None, citationref=None, noteref=None):
super(objrefSub, self).__init__(hlink, priv, region, attribute, citationref, noteref, )
supermod.objref.subclass = objrefSub
# end class objrefSub
class placerefSub(supermod.placeref):
def __init__(self, hlink=None, daterange=None, datespan=None, dateval=None, datestr=None):
super(placerefSub, self).__init__(hlink, daterange, datespan, dateval, datestr, )
supermod.placeref.subclass = placerefSub
# end class placerefSub
class regionSub(supermod.region):
def __init__(self, corner1_x=None, corner1_y=None, corner2_y=None, corner2_x=None):
super(regionSub, self).__init__(corner1_x, corner1_y, corner2_y, corner2_x, )
supermod.region.subclass = regionSub
# end class regionSub
class data_itemSub(supermod.data_item):
def __init__(self, value=None, key=None):
super(data_itemSub, self).__init__(value, key, )
supermod.data_item.subclass = data_itemSub
# end class data_itemSub
class lds_ordSub(supermod.lds_ord):
def __init__(self, type_=None, priv=None, daterange=None, datespan=None, dateval=None, datestr=None, temple=None, place=None, status=None, sealed_to=None, noteref=None, citationref=None):
super(lds_ordSub, self).__init__(type_, priv, daterange, datespan, dateval, datestr, temple, place, status, sealed_to, noteref, citationref, )
supermod.lds_ord.subclass = lds_ordSub
# end class lds_ordSub
class templeSub(supermod.temple):
def __init__(self, val=None):
super(templeSub, self).__init__(val, )
supermod.temple.subclass = templeSub
# end class templeSub
class statusSub(supermod.status):
def __init__(self, val=None):
super(statusSub, self).__init__(val, )
supermod.status.subclass = statusSub
# end class statusSub
class sealed_toSub(supermod.sealed_to):
def __init__(self, hlink=None):
super(sealed_toSub, self).__init__(hlink, )
supermod.sealed_to.subclass = sealed_toSub
# end class sealed_toSub
def get_root_tag(node):
tag = supermod.Tag_pattern_.match(node.tag).groups()[-1]
rootClass = None
rootClass = supermod.GDSClassesMapping.get(tag)
if rootClass is None and hasattr(supermod, tag):
rootClass = getattr(supermod, tag)
return tag, rootClass
def parse(inFilename, silence=False):
doc = parsexml_(inFilename)
rootNode = doc.getroot()
rootTag, rootClass = get_root_tag(rootNode)
if rootClass is None:
rootTag = 'database'
rootClass = supermod.database
rootObj = rootClass.factory()
rootObj.build(rootNode)
# Enable Python to collect the space used by the DOM.
doc = None
if not silence:
sys.stdout.write('<?xml version="1.0" ?>\n')
rootObj.export(
sys.stdout, 0, name_=rootTag,
namespacedef_='xmlns:gramps="http://gramps-project.org/xml/1.6.0/"',
pretty_print=True)
return rootObj
def parseEtree(inFilename, silence=False):
doc = parsexml_(inFilename)
rootNode = doc.getroot()
rootTag, rootClass = get_root_tag(rootNode)
if rootClass is None:
rootTag = 'database'
rootClass = supermod.database
rootObj = rootClass.factory()
rootObj.build(rootNode)
# Enable Python to collect the space used by the DOM.
doc = None
mapping = {}
rootElement = rootObj.to_etree(None, name_=rootTag, mapping_=mapping)
reverse_mapping = rootObj.gds_reverse_node_mapping(mapping)
if not silence:
content = etree_.tostring(
rootElement, pretty_print=True,
xml_declaration=True, encoding="utf-8")
sys.stdout.write(content)
sys.stdout.write('\n')
return rootObj, rootElement, mapping, reverse_mapping
def parseString(inString, silence=False):
from StringIO import StringIO
doc = parsexml_(StringIO(inString))
rootNode = doc.getroot()
rootTag, rootClass = get_root_tag(rootNode)
if rootClass is None:
rootTag = 'database'
rootClass = supermod.database
rootObj = rootClass.factory()
rootObj.build(rootNode)
# Enable Python to collect the space used by the DOM.
doc = None
if not silence:
sys.stdout.write('<?xml version="1.0" ?>\n')
rootObj.export(
sys.stdout, 0, name_=rootTag,
namespacedef_='xmlns:gramps="http://gramps-project.org/xml/1.6.0/"')
return rootObj
def parseLiteral(inFilename, silence=False):
doc = parsexml_(inFilename)
rootNode = doc.getroot()
rootTag, rootClass = get_root_tag(rootNode)
if rootClass is None:
rootTag = 'database'
rootClass = supermod.database
rootObj = rootClass.factory()
rootObj.build(rootNode)
# Enable Python to collect the space used by the DOM.
doc = None
if not silence:
sys.stdout.write('#from ??? import *\n\n')
sys.stdout.write('import ??? as model_\n\n')
sys.stdout.write('rootObj = model_.rootClass(\n')
rootObj.exportLiteral(sys.stdout, 0, name_=rootTag)
sys.stdout.write(')\n')
return rootObj
USAGE_TEXT = """
Usage: python ???.py <infilename>
"""
def usage():
print USAGE_TEXT
sys.exit(1)
def main():
args = sys.argv[1:]
if len(args) != 1:
usage()
infilename = args[0]
parse(infilename)
if __name__ == '__main__':
#import pdb; pdb.set_trace()
main()