Bug #2625: Need to bring XML DTD, import, export to use changes in trunk. These changes add support for dualdated and newyear dates.

svn: r11794
This commit is contained in:
Doug Blank 2009-02-01 22:25:45 +00:00
parent bccc1be7f2
commit 9bc8d68251
3 changed files with 34 additions and 16 deletions

View File

@ -383,6 +383,8 @@ SHARED ELEMENTS
stop CDATA #REQUIRED stop CDATA #REQUIRED
quality (estimated|calculated) #IMPLIED quality (estimated|calculated) #IMPLIED
cformat CDATA #IMPLIED cformat CDATA #IMPLIED
dualdated (0|1) #IMPLIED
newyear CDATA #IMPLIED
> >
<!ELEMENT datespan EMPTY> <!ELEMENT datespan EMPTY>
@ -391,6 +393,8 @@ SHARED ELEMENTS
stop CDATA #REQUIRED stop CDATA #REQUIRED
quality (estimated|calculated) #IMPLIED quality (estimated|calculated) #IMPLIED
cformat CDATA #IMPLIED cformat CDATA #IMPLIED
dualdated (0|1) #IMPLIED
newyear CDATA #IMPLIED
> >
<!ELEMENT dateval EMPTY> <!ELEMENT dateval EMPTY>
@ -399,6 +403,8 @@ SHARED ELEMENTS
type (before|after|about) #IMPLIED type (before|after|about) #IMPLIED
quality (estimated|calculated) #IMPLIED quality (estimated|calculated) #IMPLIED
cformat CDATA #IMPLIED cformat CDATA #IMPLIED
dualdated (0|1) #IMPLIED
newyear CDATA #IMPLIED
> >
<!ELEMENT datestr EMPTY> <!ELEMENT datestr EMPTY>

View File

@ -822,8 +822,9 @@ class GrampsDbXmlWriter(UpdateCallback):
d1 = self.get_iso_date(date.get_start_date()) d1 = self.get_iso_date(date.get_start_date())
d2 = self.get_iso_date(date.get_stop_date()) d2 = self.get_iso_date(date.get_stop_date())
if d1 != "" or d2 != "": if d1 != "" or d2 != "":
self.g.write('%s<%s start="%s" stop="%s"%s%s/>\n' self.g.write('%s<%s start="%s" stop="%s"%s%s%s%s/>\n'
% (sp,tagname,d1,d2,qual_str,calstr)) % (sp,tagname,d1,d2,qual_str,calstr,
dualdated_str, newyear_str))
elif mode != gen.lib.Date.MOD_TEXTONLY: elif mode != gen.lib.Date.MOD_TEXTONLY:
date_str = self.get_iso_date(date.get_start_date()) date_str = self.get_iso_date(date.get_start_date())
if date_str == "": if date_str == "":

View File

@ -1752,9 +1752,20 @@ class GrampsParser(UpdateCallback):
else: else:
qual = gen.lib.Date.QUAL_NONE qual = gen.lib.Date.QUAL_NONE
dualdated = False
if 'dualdated' in attrs:
val = attrs['dualdated']
if val == "1":
dualdated = True
newyear = gen.lib.Date.NEWYEAR_JAN1
if 'newyear' in attrs:
newyear = int(attrs['newyear'])
date_value.set(qual, mode, cal, date_value.set(qual, mode, cal,
(day, month, year, False, rng_day, (day, month, year, dualdated,
rng_month, rng_year, False)) rng_day, rng_month, rng_year, dualdated),
newyear=newyear)
def start_dateval(self, attrs): def start_dateval(self, attrs):
if self.source_ref: if self.source_ref: