* doc/grampsxml.dtd: Update to reflect new XML.
* src/GrampsDb/_ReadGedcom.py (parse_repo_ref_caln): Properly set media type. * src/GrampsDb/_WriteXML.py: More XML updates. svn: r5845
This commit is contained in:
parent
9dcdd2ceeb
commit
7bb8247a7f
@ -3,6 +3,11 @@
|
|||||||
* src/GrampsDb/_GrampsBSDDB.py: Correct duplicate event IDs on upgrade.
|
* src/GrampsDb/_GrampsBSDDB.py: Correct duplicate event IDs on upgrade.
|
||||||
* src/GrampsDb/_WriteXML.py: More XML updates.
|
* src/GrampsDb/_WriteXML.py: More XML updates.
|
||||||
|
|
||||||
|
* doc/grampsxml.dtd: Update to reflect new XML.
|
||||||
|
* src/GrampsDb/_ReadGedcom.py (parse_repo_ref_caln): Properly set
|
||||||
|
media type.
|
||||||
|
* src/GrampsDb/_WriteXML.py: More XML updates.
|
||||||
|
|
||||||
2006-01-27 Don Allingham <don@gramps-project.org>
|
2006-01-27 Don Allingham <don@gramps-project.org>
|
||||||
* src/GrampsDb/_ReadGedcomp.py: preselect gramps ids for events
|
* src/GrampsDb/_ReadGedcomp.py: preselect gramps ids for events
|
||||||
|
|
||||||
|
@ -50,8 +50,8 @@ DATABASE
|
|||||||
bookmarks
|
bookmarks
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!ELEMENT database (header, people?, families?, sources?, places?, objects?,
|
<!ELEMENT database (header, people?, families?, events?, sources?,
|
||||||
bookmarks?)>
|
places?, objects?, repositories?, bookmarks?)>
|
||||||
<!ATTLIST database xmlns CDATA #FIXED "http://gramps-project.org/xml/1.1.0/">
|
<!ATTLIST database xmlns CDATA #FIXED "http://gramps-project.org/xml/1.1.0/">
|
||||||
|
|
||||||
<!-- ************************************************************
|
<!-- ************************************************************
|
||||||
@ -93,12 +93,13 @@ PEOPLE
|
|||||||
|
|
||||||
<!ELEMENT person (gender, name*, nick?, eventref*, lds_ord*,
|
<!ELEMENT person (gender, name*, nick?, eventref*, lds_ord*,
|
||||||
objref*, address*, attribute*, url*,
|
objref*, address*, attribute*, url*,
|
||||||
childof*, parentin*, note?, sourceref*, marker?)>
|
childof*, parentin*, note?, sourceref*)>
|
||||||
<!ATTLIST person
|
<!ATTLIST person
|
||||||
id CDATA #REQUIRED
|
id CDATA #REQUIRED
|
||||||
handle ID #REQUIRED
|
handle ID #REQUIRED
|
||||||
change CDATA #REQUIRED
|
|
||||||
priv (0|1) #IMPLIED
|
priv (0|1) #IMPLIED
|
||||||
|
marker CDATA #IMPLIED
|
||||||
|
change CDATA #REQUIRED
|
||||||
>
|
>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
@ -157,14 +158,14 @@ FAMILY
|
|||||||
|
|
||||||
<!ELEMENT families (family)*>
|
<!ELEMENT families (family)*>
|
||||||
|
|
||||||
<!ELEMENT family (father?,mother?,eventref*,lds_ord*,
|
<!ELEMENT family (rel?,father?,mother?,eventref*,lds_ord*,
|
||||||
objref*,child*,attribute*,note?,sourceref*,marker?)>
|
objref*,child*,attribute*,note?,sourceref*)>
|
||||||
<!ATTLIST family
|
<!ATTLIST family
|
||||||
id CDATA #REQUIRED
|
id CDATA #REQUIRED
|
||||||
handle ID #REQUIRED
|
handle ID #REQUIRED
|
||||||
change CDATA #REQUIRED
|
|
||||||
priv (0|1) #IMPLIED
|
priv (0|1) #IMPLIED
|
||||||
type CDATA #IMPLIED
|
marker CDATA #IMPLIED
|
||||||
|
change CDATA #REQUIRED
|
||||||
>
|
>
|
||||||
|
|
||||||
<!ELEMENT father EMPTY>
|
<!ELEMENT father EMPTY>
|
||||||
@ -176,18 +177,24 @@ FAMILY
|
|||||||
<!ELEMENT child EMPTY>
|
<!ELEMENT child EMPTY>
|
||||||
<!ATTLIST child hlink IDREF #REQUIRED>
|
<!ATTLIST child hlink IDREF #REQUIRED>
|
||||||
|
|
||||||
|
<!ELEMENT type (#PCDATA)>
|
||||||
|
|
||||||
|
<!ELEMENT rel EMPTY>
|
||||||
|
<!ATTLIST rel type CDATA #REQUIRED>
|
||||||
|
|
||||||
<!-- ************************************************************
|
<!-- ************************************************************
|
||||||
EVENT
|
EVENT
|
||||||
-->
|
-->
|
||||||
|
<!ELEMENT events (event)*>
|
||||||
|
|
||||||
<!ELEMENT event ((daterange|dateval|datestr)?,place?,cause?,
|
<!ELEMENT event (type?,(daterange|dateval|datestr)?,place?,cause?,
|
||||||
description?,note?,sourceref*,objref*,marker?)>
|
description?,note?,sourceref*,objref*)>
|
||||||
<!ATTLIST event
|
<!ATTLIST event
|
||||||
id CDATA #REQUIRED
|
id CDATA #REQUIRED
|
||||||
handle ID #REQUIRED
|
handle ID #REQUIRED
|
||||||
change CDATA #REQUIRED
|
|
||||||
priv (0|1) #IMPLIED
|
priv (0|1) #IMPLIED
|
||||||
type CDATA #IMPLIED
|
marker CDATA #IMPLIED
|
||||||
|
change CDATA #REQUIRED
|
||||||
>
|
>
|
||||||
|
|
||||||
<!-- ************************************************************
|
<!-- ************************************************************
|
||||||
@ -196,12 +203,13 @@ SOURCES
|
|||||||
|
|
||||||
<!ELEMENT sources (source)*>
|
<!ELEMENT sources (source)*>
|
||||||
<!ELEMENT source (stitle?,sauthor?,spubinfo?,sabbrev?,
|
<!ELEMENT source (stitle?,sauthor?,spubinfo?,sabbrev?,
|
||||||
note?,objref*,data_item*,reporef*,marker?)>
|
note?,objref*,data_item*,reporef*)>
|
||||||
<!ATTLIST source
|
<!ATTLIST source
|
||||||
id CDATA #REQUIRED
|
id CDATA #REQUIRED
|
||||||
handle ID #REQUIRED
|
handle ID #REQUIRED
|
||||||
change CDATA #REQUIRED
|
|
||||||
priv (0|1) #IMPLIED
|
priv (0|1) #IMPLIED
|
||||||
|
marker CDATA #IMPLIED
|
||||||
|
change CDATA #REQUIRED
|
||||||
>
|
>
|
||||||
<!ELEMENT stitle (#PCDATA)>
|
<!ELEMENT stitle (#PCDATA)>
|
||||||
<!ELEMENT sauthor (#PCDATA)>
|
<!ELEMENT sauthor (#PCDATA)>
|
||||||
@ -214,15 +222,17 @@ PLACES
|
|||||||
|
|
||||||
<!ELEMENT places (placeobj)*>
|
<!ELEMENT places (placeobj)*>
|
||||||
|
|
||||||
<!ELEMENT placeobj (coord?,location*,objref*,url*,note?,sourceref*,marker?)>
|
<!ELEMENT placeobj (ptitle?,coord?,location*,objref*,url*,note?,sourceref*)>
|
||||||
<!ATTLIST placeobj
|
<!ATTLIST placeobj
|
||||||
id CDATA #REQUIRED
|
id CDATA #REQUIRED
|
||||||
handle ID #REQUIRED
|
handle ID #REQUIRED
|
||||||
change CDATA #REQUIRED
|
|
||||||
priv (0|1) #IMPLIED
|
priv (0|1) #IMPLIED
|
||||||
title CDATA #REQUIRED
|
marker CDATA #IMPLIED
|
||||||
|
change CDATA #REQUIRED
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<!ELEMENT ptitle (#PCDATA)>
|
||||||
|
|
||||||
<!ELEMENT coord EMPTY>
|
<!ELEMENT coord EMPTY>
|
||||||
<!ATTLIST coord
|
<!ATTLIST coord
|
||||||
long CDATA #REQUIRED
|
long CDATA #REQUIRED
|
||||||
@ -246,13 +256,18 @@ OBJECTS
|
|||||||
|
|
||||||
<!ELEMENT objects (object)*>
|
<!ELEMENT objects (object)*>
|
||||||
|
|
||||||
<!ELEMENT object (attribute*,note?,(daterange|dateval|datestr)?,
|
<!ELEMENT object (file,attribute*,note?,(daterange|dateval|datestr)?,
|
||||||
sourceref*,marker?)>
|
sourceref*)>
|
||||||
<!ATTLIST object
|
<!ATTLIST object
|
||||||
id CDATA #REQUIRED
|
id CDATA #REQUIRED
|
||||||
handle ID #REQUIRED
|
handle ID #REQUIRED
|
||||||
change CDATA #REQUIRED
|
|
||||||
priv (0|1) #IMPLIED
|
priv (0|1) #IMPLIED
|
||||||
|
marker CDATA #IMPLIED
|
||||||
|
change CDATA #REQUIRED
|
||||||
|
>
|
||||||
|
|
||||||
|
<!ELEMENT file EMPTY>
|
||||||
|
<!ATTLIST file
|
||||||
src CDATA #REQUIRED
|
src CDATA #REQUIRED
|
||||||
mime CDATA #REQUIRED
|
mime CDATA #REQUIRED
|
||||||
description CDATA #REQUIRED
|
description CDATA #REQUIRED
|
||||||
@ -264,14 +279,17 @@ REPOSITORIES
|
|||||||
|
|
||||||
<!ELEMENT repositories (repository)*>
|
<!ELEMENT repositories (repository)*>
|
||||||
|
|
||||||
<!ELEMENT repository (name,type,address*,url*,note?,marker?)>
|
<!ELEMENT repository (rname,type,address*,url*,note?)>
|
||||||
<!ATTLIST repository
|
<!ATTLIST repository
|
||||||
id CDATA #REQUIRED
|
id CDATA #REQUIRED
|
||||||
handle ID #REQUIRED
|
handle ID #REQUIRED
|
||||||
change CDATA #REQUIRED
|
|
||||||
priv (0|1) #IMPLIED
|
priv (0|1) #IMPLIED
|
||||||
|
marker CDATA #IMPLIED
|
||||||
|
change CDATA #REQUIRED
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<!ELEMENT rname (#PCDATA)>
|
||||||
|
|
||||||
|
|
||||||
<!-- ************************************************************
|
<!-- ************************************************************
|
||||||
BOOKMARKS
|
BOOKMARKS
|
||||||
|
@ -70,6 +70,7 @@ from _GedcomInfo import *
|
|||||||
from _GedTokens import *
|
from _GedTokens import *
|
||||||
from QuestionDialog import ErrorDialog, WarningDialog
|
from QuestionDialog import ErrorDialog, WarningDialog
|
||||||
from _GrampsDbBase import EVENT_KEY
|
from _GrampsDbBase import EVENT_KEY
|
||||||
|
import _ConstXML
|
||||||
|
|
||||||
addr_re = re.compile('(.+)([\n\r]+)(.+)\s*,(.+)\s+(\d+)\s*(.*)')
|
addr_re = re.compile('(.+)([\n\r]+)(.+)\s*,(.+)\s+(\d+)\s*(.*)')
|
||||||
addr2_re = re.compile('(.+)([\n\r]+)(.+)\s*,(.+)\s+(\d+)')
|
addr2_re = re.compile('(.+)([\n\r]+)(.+)\s*,(.+)\s+(\d+)')
|
||||||
@ -976,14 +977,16 @@ class GedcomParser:
|
|||||||
else:
|
else:
|
||||||
self.barf(1)
|
self.barf(1)
|
||||||
|
|
||||||
def parse_repo_ref_caln(self, repo, level):
|
def parse_repo_ref_caln(self, reporef, level):
|
||||||
while True:
|
while True:
|
||||||
matches = self.get_next()
|
matches = self.get_next()
|
||||||
if int(matches[0]) < level:
|
if int(matches[0]) < level:
|
||||||
self.backup()
|
self.backup()
|
||||||
return
|
return
|
||||||
elif matches[1] == TOKEN_MEDI:
|
elif matches[1] == TOKEN_MEDI:
|
||||||
repo.set_media_type(matches[2])
|
media_type = _ConstXML.tuple_from_xml(
|
||||||
|
_ConstXML.source_media_types,matches[2])
|
||||||
|
reporef.set_media_type(media_type)
|
||||||
else:
|
else:
|
||||||
self.barf(1)
|
self.barf(1)
|
||||||
|
|
||||||
|
@ -245,8 +245,9 @@ class XmlWriter:
|
|||||||
self.g.write(" <people")
|
self.g.write(" <people")
|
||||||
person = self.db.get_default_person()
|
person = self.db.get_default_person()
|
||||||
if person:
|
if person:
|
||||||
self.g.write(' default="%s" home="_%s">\n' %
|
self.g.write(' default="%s" home="_%s"' %
|
||||||
(person.gramps_id,person.handle))
|
(person.gramps_id,person.handle))
|
||||||
|
self.g.write('>\n')
|
||||||
|
|
||||||
sorted_keys = self.db.get_gramps_ids(PERSON_KEY)
|
sorted_keys = self.db.get_gramps_ids(PERSON_KEY)
|
||||||
sorted_keys.sort()
|
sorted_keys.sort()
|
||||||
@ -480,7 +481,7 @@ class XmlWriter:
|
|||||||
if repo.get_note() != "":
|
if repo.get_note() != "":
|
||||||
self.write_note("note",repo.get_note_object(),index+1)
|
self.write_note("note",repo.get_note_object(),index+1)
|
||||||
#name
|
#name
|
||||||
self.write_line('name',repo.name,index+1)
|
self.write_line('rname',repo.name,index+1)
|
||||||
rtype = _ConstXML.str_for_xml(_ConstXML.repository_types,repo.type)
|
rtype = _ConstXML.str_for_xml(_ConstXML.repository_types,repo.type)
|
||||||
if rtype:
|
if rtype:
|
||||||
self.write_line('type',rtype,index+1)
|
self.write_line('type',rtype,index+1)
|
||||||
@ -618,7 +619,7 @@ class XmlWriter:
|
|||||||
marker_text = ''
|
marker_text = ''
|
||||||
priv_text = conf_priv(obj)
|
priv_text = conf_priv(obj)
|
||||||
change_text = ' change="%d"' % obj.get_change_time()
|
change_text = ' change="%d"' % obj.get_change_time()
|
||||||
handle_id_text = ' handle="_%s" id="%s"' % (obj.handle,obj.gramps_id)
|
handle_id_text = ' id="%s" handle="_%s"' % (obj.gramps_id,obj.handle)
|
||||||
obj_text = '%s<%s' % (sp,tagname)
|
obj_text = '%s<%s' % (sp,tagname)
|
||||||
|
|
||||||
self.g.write(obj_text + handle_id_text + priv_text + marker_text +
|
self.g.write(obj_text + handle_id_text + priv_text + marker_text +
|
||||||
@ -631,7 +632,7 @@ class XmlWriter:
|
|||||||
rel = _ConstXML.str_for_xml(_ConstXML.family_relations,
|
rel = _ConstXML.str_for_xml(_ConstXML.family_relations,
|
||||||
family.get_relationship())
|
family.get_relationship())
|
||||||
if rel != "":
|
if rel != "":
|
||||||
self.g.write('%s<rel type="%s"/>\n' % (sp,rel) )
|
self.g.write(' %s<rel type="%s"/>\n' % (sp,rel) )
|
||||||
|
|
||||||
def write_last(self,name,indent=1):
|
def write_last(self,name,indent=1):
|
||||||
p = name.get_surname_prefix()
|
p = name.get_surname_prefix()
|
||||||
@ -871,7 +872,7 @@ class XmlWriter:
|
|||||||
mtype = _ConstXML.str_for_xml(_ConstXML.source_media_types,
|
mtype = _ConstXML.str_for_xml(_ConstXML.source_media_types,
|
||||||
reporef.media_type)
|
reporef.media_type)
|
||||||
if mtype:
|
if mtype:
|
||||||
type_text = ' type="%s"' % mtype
|
type_text = ' medium="%s"' % mtype
|
||||||
else:
|
else:
|
||||||
type_text = ''
|
type_text = ''
|
||||||
|
|
||||||
@ -922,7 +923,7 @@ class XmlWriter:
|
|||||||
|
|
||||||
if title == "":
|
if title == "":
|
||||||
title = self.fix(self.build_place_title(place.get_main_location()))
|
title = self.fix(self.build_place_title(place.get_main_location()))
|
||||||
self.write_line("title",title,index+1)
|
self.write_line("ptitle",title,index+1)
|
||||||
|
|
||||||
if longitude or lat:
|
if longitude or lat:
|
||||||
self.g.write('%s<coord long="%s" lat="%s"/>\n'
|
self.g.write('%s<coord long="%s" lat="%s"/>\n'
|
||||||
|
Loading…
Reference in New Issue
Block a user