* 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:
Alex Roitman 2006-01-28 00:43:27 +00:00
parent 9b90eeb365
commit d5c04162a2
4 changed files with 75 additions and 48 deletions

View File

@ -3,6 +3,11 @@
* src/GrampsDb/_GrampsBSDDB.py: Correct duplicate event IDs on upgrade.
* 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>
* src/GrampsDb/_ReadGedcomp.py: preselect gramps ids for events

View File

@ -50,8 +50,8 @@ DATABASE
bookmarks
-->
<!ELEMENT database (header, people?, families?, sources?, places?, objects?,
bookmarks?)>
<!ELEMENT database (header, people?, families?, events?, sources?,
places?, objects?, repositories?, bookmarks?)>
<!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*,
objref*, address*, attribute*, url*,
childof*, parentin*, note?, sourceref*, marker?)>
childof*, parentin*, note?, sourceref*)>
<!ATTLIST person
id CDATA #REQUIRED
handle ID #REQUIRED
change CDATA #REQUIRED
priv (0|1) #IMPLIED
marker CDATA #IMPLIED
change CDATA #REQUIRED
>
<!--
@ -157,14 +158,14 @@ FAMILY
<!ELEMENT families (family)*>
<!ELEMENT family (father?,mother?,eventref*,lds_ord*,
objref*,child*,attribute*,note?,sourceref*,marker?)>
<!ELEMENT family (rel?,father?,mother?,eventref*,lds_ord*,
objref*,child*,attribute*,note?,sourceref*)>
<!ATTLIST family
id CDATA #REQUIRED
handle ID #REQUIRED
change CDATA #REQUIRED
priv (0|1) #IMPLIED
type CDATA #IMPLIED
id CDATA #REQUIRED
handle ID #REQUIRED
priv (0|1) #IMPLIED
marker CDATA #IMPLIED
change CDATA #REQUIRED
>
<!ELEMENT father EMPTY>
@ -176,18 +177,24 @@ FAMILY
<!ELEMENT child EMPTY>
<!ATTLIST child hlink IDREF #REQUIRED>
<!ELEMENT type (#PCDATA)>
<!ELEMENT rel EMPTY>
<!ATTLIST rel type CDATA #REQUIRED>
<!-- ************************************************************
EVENT
-->
<!ELEMENT events (event)*>
<!ELEMENT event ((daterange|dateval|datestr)?,place?,cause?,
description?,note?,sourceref*,objref*,marker?)>
<!ELEMENT event (type?,(daterange|dateval|datestr)?,place?,cause?,
description?,note?,sourceref*,objref*)>
<!ATTLIST event
id CDATA #REQUIRED
handle ID #REQUIRED
change CDATA #REQUIRED
priv (0|1) #IMPLIED
type CDATA #IMPLIED
id CDATA #REQUIRED
handle ID #REQUIRED
priv (0|1) #IMPLIED
marker CDATA #IMPLIED
change CDATA #REQUIRED
>
<!-- ************************************************************
@ -196,12 +203,13 @@ SOURCES
<!ELEMENT sources (source)*>
<!ELEMENT source (stitle?,sauthor?,spubinfo?,sabbrev?,
note?,objref*,data_item*,reporef*,marker?)>
note?,objref*,data_item*,reporef*)>
<!ATTLIST source
id CDATA #REQUIRED
handle ID #REQUIRED
change CDATA #REQUIRED
priv (0|1) #IMPLIED
id CDATA #REQUIRED
handle ID #REQUIRED
priv (0|1) #IMPLIED
marker CDATA #IMPLIED
change CDATA #REQUIRED
>
<!ELEMENT stitle (#PCDATA)>
<!ELEMENT sauthor (#PCDATA)>
@ -214,15 +222,17 @@ PLACES
<!ELEMENT places (placeobj)*>
<!ELEMENT placeobj (coord?,location*,objref*,url*,note?,sourceref*,marker?)>
<!ELEMENT placeobj (ptitle?,coord?,location*,objref*,url*,note?,sourceref*)>
<!ATTLIST placeobj
id CDATA #REQUIRED
handle ID #REQUIRED
change CDATA #REQUIRED
priv (0|1) #IMPLIED
title CDATA #REQUIRED
id CDATA #REQUIRED
handle ID #REQUIRED
priv (0|1) #IMPLIED
marker CDATA #IMPLIED
change CDATA #REQUIRED
>
<!ELEMENT ptitle (#PCDATA)>
<!ELEMENT coord EMPTY>
<!ATTLIST coord
long CDATA #REQUIRED
@ -246,13 +256,18 @@ OBJECTS
<!ELEMENT objects (object)*>
<!ELEMENT object (attribute*,note?,(daterange|dateval|datestr)?,
sourceref*,marker?)>
<!ELEMENT object (file,attribute*,note?,(daterange|dateval|datestr)?,
sourceref*)>
<!ATTLIST object
id CDATA #REQUIRED
handle ID #REQUIRED
change CDATA #REQUIRED
priv (0|1) #IMPLIED
id CDATA #REQUIRED
handle ID #REQUIRED
priv (0|1) #IMPLIED
marker CDATA #IMPLIED
change CDATA #REQUIRED
>
<!ELEMENT file EMPTY>
<!ATTLIST file
src CDATA #REQUIRED
mime CDATA #REQUIRED
description CDATA #REQUIRED
@ -264,14 +279,17 @@ REPOSITORIES
<!ELEMENT repositories (repository)*>
<!ELEMENT repository (name,type,address*,url*,note?,marker?)>
<!ELEMENT repository (rname,type,address*,url*,note?)>
<!ATTLIST repository
id CDATA #REQUIRED
handle ID #REQUIRED
change CDATA #REQUIRED
priv (0|1) #IMPLIED
id CDATA #REQUIRED
handle ID #REQUIRED
priv (0|1) #IMPLIED
marker CDATA #IMPLIED
change CDATA #REQUIRED
>
<!ELEMENT rname (#PCDATA)>
<!-- ************************************************************
BOOKMARKS

View File

@ -70,6 +70,7 @@ from _GedcomInfo import *
from _GedTokens import *
from QuestionDialog import ErrorDialog, WarningDialog
from _GrampsDbBase import EVENT_KEY
import _ConstXML
addr_re = re.compile('(.+)([\n\r]+)(.+)\s*,(.+)\s+(\d+)\s*(.*)')
addr2_re = re.compile('(.+)([\n\r]+)(.+)\s*,(.+)\s+(\d+)')
@ -976,14 +977,16 @@ class GedcomParser:
else:
self.barf(1)
def parse_repo_ref_caln(self, repo, level):
def parse_repo_ref_caln(self, reporef, level):
while True:
matches = self.get_next()
if int(matches[0]) < level:
self.backup()
return
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:
self.barf(1)

View File

@ -245,8 +245,9 @@ class XmlWriter:
self.g.write(" <people")
person = self.db.get_default_person()
if person:
self.g.write(' default="%s" home="_%s">\n' %
self.g.write(' default="%s" home="_%s"' %
(person.gramps_id,person.handle))
self.g.write('>\n')
sorted_keys = self.db.get_gramps_ids(PERSON_KEY)
sorted_keys.sort()
@ -480,7 +481,7 @@ class XmlWriter:
if repo.get_note() != "":
self.write_note("note",repo.get_note_object(),index+1)
#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)
if rtype:
self.write_line('type',rtype,index+1)
@ -618,7 +619,7 @@ class XmlWriter:
marker_text = ''
priv_text = conf_priv(obj)
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)
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,
family.get_relationship())
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):
p = name.get_surname_prefix()
@ -871,7 +872,7 @@ class XmlWriter:
mtype = _ConstXML.str_for_xml(_ConstXML.source_media_types,
reporef.media_type)
if mtype:
type_text = ' type="%s"' % mtype
type_text = ' medium="%s"' % mtype
else:
type_text = ''
@ -922,7 +923,7 @@ class XmlWriter:
if title == "":
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:
self.g.write('%s<coord long="%s" lat="%s"/>\n'