Update Gramps XML schemas
Also made a slight change to the XML format for places.
This commit is contained in:
parent
5f7f7104ac
commit
27dab7c811
@ -5,7 +5,7 @@
|
||||
#
|
||||
# Copyright (C) 2001 Graham J. Williams
|
||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||
# Copyright (C) 2010-2011 Nick Hall
|
||||
# Copyright (C) 2010-2014 Nick Hall
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -248,16 +248,20 @@ PLACES
|
||||
|
||||
<!ELEMENT places (placeobj)*>
|
||||
|
||||
<!ELEMENT placeobj (ptitle?, coord?, location*, objref*, url*, noteref*,
|
||||
citationref*, tagref*)>
|
||||
<!ELEMENT placeobj (ptitle?, code?, alt_name*, coord?, placeref*, location*,
|
||||
objref*, url*, noteref*, citationref*, tagref*)>
|
||||
<!ATTLIST placeobj
|
||||
id CDATA #IMPLIED
|
||||
handle ID #REQUIRED
|
||||
priv (0|1) #IMPLIED
|
||||
change CDATA #REQUIRED
|
||||
name CDATA #REQUIRED
|
||||
type CDATA #REQUIRED
|
||||
>
|
||||
|
||||
<!ELEMENT ptitle (#PCDATA)>
|
||||
<!ELEMENT code (#PCDATA)>
|
||||
<!ELEMENT alt_name (#PCDATA)>
|
||||
|
||||
<!ELEMENT coord EMPTY>
|
||||
<!ATTLIST coord
|
||||
@ -522,6 +526,11 @@ SHARED ELEMENTS
|
||||
priv (0|1) #IMPLIED
|
||||
>
|
||||
|
||||
<!ELEMENT placeref ((daterange|datespan|dateval|datestr)?)>
|
||||
<!ATTLIST placeref
|
||||
hlink IDREF #REQUIRED
|
||||
>
|
||||
|
||||
<!ELEMENT region EMPTY>
|
||||
<!ATTLIST region
|
||||
corner1_x CDATA #REQUIRED
|
||||
|
@ -4,7 +4,7 @@
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2005-2007 Donald N. Allingham
|
||||
# Copyright (C) 2010-2011 Nick Hall
|
||||
# Copyright (C) 2010-2014 Nick Hall
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -22,11 +22,10 @@
|
||||
|
||||
# Written by Alex Roitman
|
||||
|
||||
# $Id$
|
||||
-->
|
||||
|
||||
<!--
|
||||
This is the RELAX NG schema for the GRAMPS XML genealogy data format.
|
||||
This is the RELAX NG schema for the Gramps XML genealogy data format.
|
||||
-->
|
||||
|
||||
|
||||
@ -160,9 +159,6 @@
|
||||
<value>0</value>
|
||||
<value>1</value>
|
||||
</choice></attribute></optional>
|
||||
<zeroOrMore><element name="tagref">
|
||||
<ref name="tagref-content"/>
|
||||
</element></zeroOrMore>
|
||||
</define>
|
||||
|
||||
<define name="person-content">
|
||||
@ -208,6 +204,9 @@
|
||||
<zeroOrMore><element name="citationref">
|
||||
<ref name="citationref-content"/>
|
||||
</element></zeroOrMore>
|
||||
<zeroOrMore><element name="tagref">
|
||||
<ref name="tagref-content"/>
|
||||
</element></zeroOrMore>
|
||||
</define>
|
||||
|
||||
<define name="child-rel">
|
||||
@ -403,6 +402,9 @@
|
||||
<zeroOrMore><element name="citationref">
|
||||
<ref name="citationref-content"/>
|
||||
</element></zeroOrMore>
|
||||
<zeroOrMore><element name="tagref">
|
||||
<ref name="tagref-content"/>
|
||||
</element></zeroOrMore>
|
||||
</define>
|
||||
|
||||
<define name="event-content">
|
||||
@ -425,6 +427,9 @@
|
||||
<zeroOrMore><element name="objref">
|
||||
<ref name="objref-content"/>
|
||||
</element></zeroOrMore>
|
||||
<zeroOrMore><element name="tagref">
|
||||
<ref name="tagref-content"/>
|
||||
</element></zeroOrMore>
|
||||
</define>
|
||||
|
||||
<define name="citation-content">
|
||||
@ -444,6 +449,9 @@
|
||||
<element name="sourceref">
|
||||
<ref name="sourceref-content"/>
|
||||
</element>
|
||||
<zeroOrMore><element name="tagref">
|
||||
<ref name="tagref-content"/>
|
||||
</element></zeroOrMore>
|
||||
</define>
|
||||
|
||||
<define name="source-content">
|
||||
@ -464,15 +472,25 @@
|
||||
<zeroOrMore><element name="reporef">
|
||||
<ref name="reporef-content"/>
|
||||
</element></zeroOrMore>
|
||||
<zeroOrMore><element name="tagref">
|
||||
<ref name="tagref-content"/>
|
||||
</element></zeroOrMore>
|
||||
</define>
|
||||
|
||||
<define name="place-content">
|
||||
<ref name="primary-object"/>
|
||||
<attribute name="name"><text/></attribute>
|
||||
<attribute name="type"><text/></attribute>
|
||||
<optional><element name="ptitle"><text/></element></optional>
|
||||
<optional><element name="code"><text/></element></optional>
|
||||
<zeroOrMore><element name="alt_name"><text/></element></zeroOrMore>
|
||||
<optional><element name="coord">
|
||||
<attribute name="long"><text/></attribute>
|
||||
<attribute name="lat"><text/></attribute>
|
||||
</element></optional>
|
||||
<zeroOrMore><element name="placeref">
|
||||
<ref name="placeref-content"/>
|
||||
</element></zeroOrMore>
|
||||
<zeroOrMore><element name="location">
|
||||
<optional><attribute name="street"><text/></attribute></optional>
|
||||
<optional><attribute name="locality"><text/></attribute></optional>
|
||||
@ -496,6 +514,9 @@
|
||||
<zeroOrMore><element name="citationref">
|
||||
<ref name="citationref-content"/>
|
||||
</element></zeroOrMore>
|
||||
<zeroOrMore><element name="tagref">
|
||||
<ref name="tagref-content"/>
|
||||
</element></zeroOrMore>
|
||||
</define>
|
||||
|
||||
<define name="object-content">
|
||||
@ -503,8 +524,8 @@
|
||||
<element name="file">
|
||||
<attribute name="src"><text/></attribute>
|
||||
<attribute name="mime"><text/></attribute>
|
||||
<attribute name="checksum"><text/></attribute>
|
||||
<attribute name="description"><text/></attribute>
|
||||
<optional><attribute name="checksum"><text/></attribute></optional>
|
||||
<optional><attribute name="description"><text/></attribute></optional>
|
||||
</element>
|
||||
<zeroOrMore><element name="attribute">
|
||||
<ref name="attribute-content"/>
|
||||
@ -516,6 +537,9 @@
|
||||
<zeroOrMore><element name="citationref">
|
||||
<ref name="citationref-content"/>
|
||||
</element></zeroOrMore>
|
||||
<zeroOrMore><element name="tagref">
|
||||
<ref name="tagref-content"/>
|
||||
</element></zeroOrMore>
|
||||
</define>
|
||||
|
||||
<define name="repository-content">
|
||||
@ -531,6 +555,9 @@
|
||||
<zeroOrMore><element name="noteref">
|
||||
<ref name="noteref-content"/>
|
||||
</element></zeroOrMore>
|
||||
<zeroOrMore><element name="tagref">
|
||||
<ref name="tagref-content"/>
|
||||
</element></zeroOrMore>
|
||||
</define>
|
||||
|
||||
<define name="bookmark-content">
|
||||
@ -574,6 +601,9 @@
|
||||
</choice></attribute></optional>
|
||||
<attribute name="type"><text/></attribute>
|
||||
<ref name="styledtext"/>
|
||||
<zeroOrMore><element name="tagref">
|
||||
<ref name="tagref-content"/>
|
||||
</element></zeroOrMore>
|
||||
</define>
|
||||
|
||||
<define name="styledtext">
|
||||
@ -742,6 +772,11 @@
|
||||
<text/>
|
||||
</define>
|
||||
|
||||
<define name="placeref-content">
|
||||
<attribute name="hlink"><data type="IDREF"/></attribute>
|
||||
<optional><ref name="date-content"/></optional>
|
||||
</define>
|
||||
|
||||
<define name="tagref-content">
|
||||
<attribute name="hlink"><data type="IDREF"/></attribute>
|
||||
</define>
|
||||
|
@ -1190,15 +1190,16 @@ class GrampsXmlWriter(UpdateCallback):
|
||||
)
|
||||
|
||||
def write_place_obj(self, place, index=1):
|
||||
self.write_primary_tag("placeobj", place, index)
|
||||
self.write_primary_tag("placeobj", place, index, close=False)
|
||||
pname = self.fix(place.get_name())
|
||||
ptype = self.fix(place.get_type().xml_str())
|
||||
self.g.write(' name="%s"' % pname)
|
||||
self.g.write(' type="%s"' % ptype)
|
||||
self.g.write('>\n')
|
||||
|
||||
title = self.fix(place.get_title())
|
||||
name = self.fix(place.get_name())
|
||||
ptype = self.fix(place.get_type().xml_str())
|
||||
code = self.fix(place.get_code())
|
||||
self.write_line_nofix("ptitle", title, index+1)
|
||||
self.write_line_nofix("pname", name, index+1)
|
||||
self.write_line_nofix("type", ptype, index+1)
|
||||
self.write_line_nofix("code", code, index+1)
|
||||
for name in place.get_alternative_names():
|
||||
self.write_line("alt_name", name, index+1)
|
||||
|
@ -689,7 +689,6 @@ class GrampsParser(UpdateCallback):
|
||||
"places": (None, self.stop_places),
|
||||
"placeobj": (self.start_placeobj, self.stop_placeobj),
|
||||
"placeref": (self.start_placeref, self.stop_placeref),
|
||||
"pname": (None, self.stop_pname),
|
||||
"ptitle": (None, self.stop_ptitle),
|
||||
"location": (self.start_location, None),
|
||||
"lds_ord": (self.start_lds_ord, self.stop_lds_ord),
|
||||
@ -1150,6 +1149,8 @@ class GrampsParser(UpdateCallback):
|
||||
self.inaugurate_id(attrs.get('id'), PLACE_KEY, self.placeobj)
|
||||
self.placeobj.private = bool(attrs.get("priv"))
|
||||
self.placeobj.change = int(attrs.get('change', self.change))
|
||||
self.placeobj.name = attrs.get("name")
|
||||
self.placeobj.place_type.set_from_xml_str(attrs.get("type"))
|
||||
self.info.add('new-object', PLACE_KEY, self.placeobj)
|
||||
|
||||
# GRAMPS LEGACY: title in the placeobj tag
|
||||
@ -2578,9 +2579,6 @@ class GrampsParser(UpdateCallback):
|
||||
def stop_ptitle(self, tag):
|
||||
self.placeobj.title = tag
|
||||
|
||||
def stop_pname(self, tag):
|
||||
self.placeobj.name = tag
|
||||
|
||||
def stop_code(self, tag):
|
||||
self.placeobj.code = tag
|
||||
|
||||
@ -2604,9 +2602,6 @@ class GrampsParser(UpdateCallback):
|
||||
elif self.repo:
|
||||
# Repository type
|
||||
self.repo.type.set_from_xml_str(tag)
|
||||
elif self.placeobj:
|
||||
# Place type
|
||||
self.placeobj.place_type.set_from_xml_str(tag)
|
||||
|
||||
def stop_childref(self, tag):
|
||||
self.childref = None
|
||||
|
Loading…
Reference in New Issue
Block a user