* data/grampsxml.dtd: Update DTD.

* data/grampsxml.rng: Update schema.


svn: r8201
This commit is contained in:
Alex Roitman 2007-02-21 03:29:52 +00:00
parent 302e3f1dbc
commit 16785f84ad
4 changed files with 109 additions and 85 deletions

View File

@ -1,4 +1,6 @@
2007-02-20 Alex Roitman <shura@gramps-project.org>
* data/grampsxml.dtd: Update DTD.
* data/grampsxml.rng: Update schema.
* src/GrampsDb/_GrampsDbWriteXML.py (write_xml_data): Place notes
at the end.
* src/GrampsDbUtils/_ReadXML.py (start_noteref): Add method;

View File

@ -4,7 +4,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2001 Graham J. Williams
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2000-2007 Donald N. Allingham
#
# 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
@ -24,15 +24,15 @@
-->
<!--
This is the Document Type Definition file for v1.1.3
This is the Document Type Definition file for v1.1.4
of the GRAMPS XML genealogy data format.
Please use the following formal public identifier to identify it:
"-//GRAMPS//DTD GRAMPS XML V1.1.3//EN"
"-//GRAMPS//DTD GRAMPS XML V1.1.4//EN"
For example:
<!DOCTYPE database PUBLIC "-//GRAMPS//DTD GRAMPS XML V1.1.3//EN"
"http://gramps-project.org/xml/1.1.3/grampsxml.dtd"
<!DOCTYPE database PUBLIC "-//GRAMPS//DTD GRAMPS XML V1.1.4//EN"
"http://gramps-project.org/xml/1.1.4/grampsxml.dtd"
[...]>
-->
@ -47,13 +47,15 @@ DATABASE
sources
places
objects
repositories
repositories
notes
bookmarks
-->
<!ELEMENT database (header, name-formats?, events?, people?, families?,
sources?, places?, objects?, repositories?, bookmark?)>
<!ATTLIST database xmlns CDATA #FIXED "http://gramps-project.org/xml/1.1.3/">
sources?, places?, objects?, repositories?, notes?,
bookmark?)>
<!ATTLIST database xmlns CDATA #FIXED "http://gramps-project.org/xml/1.1.4/">
<!-- ************************************************************
HEADER
@ -93,8 +95,8 @@ PEOPLE
>
<!ELEMENT person (gender, name*, nick?, eventref*, lds_ord*,
objref*, address*, attribute*, url*,
childof*, parentin*, personref*, note?, sourceref*)>
objref*, address*, attribute*, url*, childof*,
parentin*, personref*, noteref*, sourceref*)>
<!ATTLIST person
id CDATA #REQUIRED
handle ID #REQUIRED
@ -109,7 +111,7 @@ GENDER has values of M, F, or U.
<!ELEMENT gender (#PCDATA)>
<!ELEMENT name (first?,last?,suffix?,patronymic?,title?,
(daterange|dateval|datestr)?,note?,sourceref*)>
(daterange|dateval|datestr)?,noteref*,sourceref*)>
<!ATTLIST name
alt (0|1) #IMPLIED
type CDATA #IMPLIED
@ -137,7 +139,7 @@ GENDER has values of M, F, or U.
<!ELEMENT parentin EMPTY>
<!ATTLIST parentin hlink IDREF #REQUIRED>
<!ELEMENT personref (sourceref*,note?)>
<!ELEMENT personref (sourceref*,noteref*)>
<!ATTLIST personref
hlink IDREF #REQUIRED
priv (0|1) #IMPLIED
@ -145,7 +147,7 @@ GENDER has values of M, F, or U.
>
<!ELEMENT address ((daterange|dateval|datestr)?,street?,city?,county?,state?,
country?,postal?,phone?,note?,sourceref*)>
country?,postal?,phone?,noteref*,sourceref*)>
<!ATTLIST address priv (0|1) #IMPLIED>
<!ELEMENT street (#PCDATA)>
@ -165,7 +167,7 @@ FAMILY
<!ELEMENT families (family)*>
<!ELEMENT family (rel?,father?,mother?,eventref*,lds_ord*,
objref*,childref*,attribute*,note?,sourceref*)>
objref*,childref*,attribute*,noteref*,sourceref*)>
<!ATTLIST family
id CDATA #REQUIRED
handle ID #REQUIRED
@ -180,7 +182,7 @@ FAMILY
<!ELEMENT mother EMPTY>
<!ATTLIST mother hlink IDREF #REQUIRED>
<!ELEMENT childref (sourceref*,note?)>
<!ELEMENT childref (sourceref*,noteref*)>
<!ATTLIST childref
hlink IDREF #REQUIRED
priv (0|1) #IMPLIED
@ -199,7 +201,7 @@ EVENT
<!ELEMENT events (event)*>
<!ELEMENT event (type?,(daterange|dateval|datestr)?,place?,cause?,
description?,attribute*,note?,sourceref*,objref*)>
description?,attribute*,noteref*,sourceref*,objref*)>
<!ATTLIST event
id CDATA #REQUIRED
handle ID #REQUIRED
@ -214,7 +216,7 @@ SOURCES
<!ELEMENT sources (source)*>
<!ELEMENT source (stitle?,sauthor?,spubinfo?,sabbrev?,
note?,objref*,data_item*,reporef*)>
noteref*,objref*,data_item*,reporef*)>
<!ATTLIST source
id CDATA #REQUIRED
handle ID #REQUIRED
@ -233,7 +235,7 @@ PLACES
<!ELEMENT places (placeobj)*>
<!ELEMENT placeobj (ptitle?,coord?,location*,objref*,url*,note?,sourceref*)>
<!ELEMENT placeobj (ptitle?,coord?,location*,objref*,url*,noteref*,sourceref*)>
<!ATTLIST placeobj
id CDATA #REQUIRED
handle ID #REQUIRED
@ -268,7 +270,7 @@ OBJECTS
<!ELEMENT objects (object)*>
<!ELEMENT object (file,attribute*,note?,(daterange|dateval|datestr)?,
<!ELEMENT object (file,attribute*,noteref*,(daterange|dateval|datestr)?,
sourceref*)>
<!ATTLIST object
id CDATA #REQUIRED
@ -291,7 +293,7 @@ REPOSITORIES
<!ELEMENT repositories (repository)*>
<!ELEMENT repository (rname,type,address*,url*,note?)>
<!ELEMENT repository (rname,type,address*,url*,noteref*)>
<!ATTLIST repository
id CDATA #REQUIRED
handle ID #REQUIRED
@ -302,6 +304,23 @@ REPOSITORIES
<!ELEMENT rname (#PCDATA)>
<!-- ************************************************************
NOTES
-->
<!ELEMENT notes (note)*>
<!ELEMENT note (#PCDATA)>
<!ATTLIST note
id CDATA #REQUIRED
handle ID #REQUIRED
priv (0|1) #IMPLIED
marker CDATA #IMPLIED
change CDATA #REQUIRED
format (0|1) #IMPLIED
type CDATA #REQUIRED
>
<!-- ************************************************************
BOOKMARKS
@ -349,48 +368,42 @@ SHARED ELEMENTS
<!ELEMENT datestr EMPTY>
<!ATTLIST datestr val CDATA #REQUIRED>
<!ELEMENT note (#PCDATA)>
<!ATTLIST note format (0|1) #IMPLIED>
<!ELEMENT sourceref (spage?,scomments?,stext?,(daterange|dateval|datestr)?)>
<!ELEMENT sourceref (spage?,noteref*,stext?,(daterange|dateval|datestr)?)>
<!ATTLIST sourceref
hlink IDREF #REQUIRED
conf CDATA #IMPLIED
>
<!ELEMENT eventref (attribute*,note?)>
<!ELEMENT eventref (attribute*,noteref*)>
<!ATTLIST eventref
hlink IDREF #REQUIRED
priv (0|1) #IMPLIED
role CDATA #IMPLIED
>
<!ELEMENT reporef (note?)>
<!ELEMENT reporef (noteref*)>
<!ATTLIST reporef
hlink IDREF #REQUIRED
callno CDATA #IMPLIED
medium CDATA #IMPLIED
>
<!ELEMENT marker EMPTY>
<!ATTLIST marker
type CDATA #REQUIRED
<!ELEMENT noteref EMPTY>
<!ATTLIST noteref
hlink IDREF #REQUIRED
>
<!ELEMENT spage (#PCDATA)>
<!ELEMENT scomments (#PCDATA)>
<!ELEMENT sdate (#PCDATA)>
<!ELEMENT stext (#PCDATA)>
<!ELEMENT attribute (sourceref*,note?)>
<!ELEMENT attribute (sourceref*,noteref*)>
<!ATTLIST attribute
priv (0|1) #IMPLIED
type CDATA #REQUIRED
value CDATA #REQUIRED
>
<!ELEMENT comment (#PCDATA)>
<!ELEMENT place EMPTY>
<!ATTLIST place hlink IDREF #REQUIRED>
@ -405,7 +418,7 @@ SHARED ELEMENTS
description CDATA #IMPLIED
>
<!ELEMENT objref (attribute*,sourceref*,note?)>
<!ELEMENT objref (attribute*,sourceref*,noteref*)>
<!ATTLIST objref
hlink IDREF #REQUIRED
priv (0|1) #IMPLIED
@ -418,7 +431,7 @@ SHARED ELEMENTS
>
<!ELEMENT lds_ord ((daterange|dateval|datestr)?,temple?,place?,status?,
sealed_to?,note?,sourceref*)>
sealed_to?,noteref*,sourceref*)>
<!ATTLIST lds_ord
type CDATA #REQUIRED
>

View File

@ -3,7 +3,7 @@
<!--
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2005-2006 Donald N. Allingham
# Copyright (C) 2005-2007 Donald N. Allingham
#
# 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
@ -31,7 +31,7 @@
<grammar
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
ns="http://gramps-project.org/xml/1.1.3/"
ns="http://gramps-project.org/xml/1.1.4/"
xmlns="http://relaxng.org/ns/structure/1.0">
<start><element name="database">
@ -98,6 +98,12 @@
</element></zeroOrMore>
</element></optional>
<optional><element name="notes">
<zeroOrMore><element name="note">
<ref name="note-content"/>
</element></zeroOrMore>
</element></optional>
<optional><element name="bookmarks">
<zeroOrMore><element name="bookmark">
<ref name="bookmark-content"/>
@ -170,9 +176,9 @@
</attribute></optional>
<attribute name="rel"><text/></attribute>
</element></zeroOrMore>
<optional><element name="note">
<ref name="note-content"/>
</element></optional>
<zeroOrMore><element name="noteref">
<ref name="noteref-content"/>
</element></zeroOrMore>
<zeroOrMore><element name="sourceref">
<ref name="sourceref-content"/>
</element></zeroOrMore>
@ -217,9 +223,9 @@
<optional><element name="patronymic"><text/></element></optional>
<optional><element name="title"><text/></element></optional>
<optional><ref name="date-content"/></optional>
<optional><element name="note">
<ref name="note-content"/>
</element></optional>
<zeroOrMore><element name="noteref">
<ref name="noteref-content"/>
</element></zeroOrMore>
<zeroOrMore><element name="sourceref">
<ref name="sourceref-content"/>
</element></zeroOrMore>
@ -237,9 +243,9 @@
<optional><element name="country"><text/></element></optional>
<optional><element name="postal"><text/></element></optional>
<optional><element name="phone"><text/></element></optional>
<optional><element name="note">
<ref name="note-content"/>
</element></optional>
<zeroOrMore><element name="noteref">
<ref name="noteref-content"/>
</element></zeroOrMore>
<zeroOrMore><element name="sourceref">
<ref name="sourceref-content"/>
</element></zeroOrMore>
@ -310,9 +316,9 @@
<zeroOrMore><element name="attribute">
<ref name="attribute-content"/>
</element></zeroOrMore>
<optional><element name="note">
<ref name="note-content"/>
</element></optional>
<zeroOrMore><element name="noteref">
<ref name="noteref-content"/>
</element></zeroOrMore>
<optional><ref name="date-content"/></optional>
<zeroOrMore><element name="sourceref">
<ref name="sourceref-content"/>
@ -330,9 +336,9 @@
<zeroOrMore><element name="attribute">
<ref name="attribute-content"/>
</element></zeroOrMore>
<optional><element name="note">
<ref name="note-content"/>
</element></optional>
<zeroOrMore><element name="noteref">
<ref name="noteref-content"/>
</element></zeroOrMore>
<zeroOrMore><element name="sourceref">
<ref name="sourceref-content"/>
</element></zeroOrMore>
@ -347,9 +353,9 @@
<optional><element name="sauthor"><text/></element></optional>
<optional><element name="spubinfo"><text/></element></optional>
<optional><element name="sabbrev"><text/></element></optional>
<optional><element name="note">
<ref name="note-content"/>
</element></optional>
<zeroOrMore><element name="noteref">
<ref name="noteref-content"/>
</element></zeroOrMore>
<zeroOrMore><element name="objref">
<ref name="objref-content"/>
</element></zeroOrMore>
@ -385,9 +391,9 @@
<zeroOrMore><element name="url">
<ref name="url-content"/>
</element></zeroOrMore>
<optional><element name="note">
<ref name="note-content"/>
</element></optional>
<zeroOrMore><element name="noteref">
<ref name="noteref-content"/>
</element></zeroOrMore>
<zeroOrMore><element name="sourceref">
<ref name="sourceref-content"/>
</element></zeroOrMore>
@ -404,9 +410,9 @@
<zeroOrMore><element name="attribute">
<ref name="attribute-content"/>
</element></zeroOrMore>
<optional><element name="note">
<ref name="note-content"/>
</element></optional>
<zeroOrMore><element name="noteref">
<ref name="noteref-content"/>
</element></zeroOrMore>
<optional><ref name="date-content"/></optional>
<zeroOrMore><element name="sourceref">
<ref name="sourceref-content"/>
@ -423,9 +429,9 @@
<zeroOrMore><element name="url">
<ref name="url-content"/>
</element></zeroOrMore>
<optional><element name="note">
<ref name="note-content"/>
</element></optional>
<zeroOrMore><element name="noteref">
<ref name="noteref-content"/>
</element></zeroOrMore>
</define>
<define name="bookmark-content">
@ -452,10 +458,12 @@
</define>
<define name="note-content">
<ref name="primary-object"/>
<optional><attribute name="format"><choice>
<value>0</value>
<value>1</value>
</choice></attribute></optional>
<attribute name="type"><text/></attribute>
<text/>
</define>
@ -463,7 +471,9 @@
<attribute name="hlink"><data type="IDREF"/></attribute>
<optional><attribute name="conf"><text/></attribute></optional>
<optional><element name="spage"><text/></element></optional>
<optional><element name="scomments"><text/></element></optional>
<zeroOrMore><element name="noteref">
<ref name="noteref-content"/>
</element></zeroOrMore>
<optional><element name="stext"><text/></element></optional>
<optional><ref name="date-content"/></optional>
</define>
@ -477,18 +487,22 @@
<zeroOrMore><element name="attribute">
<ref name="attribute-content"/>
</element></zeroOrMore>
<optional><element name="note">
<ref name="note-content"/>
</element></optional>
<zeroOrMore><element name="noteref">
<ref name="noteref-content"/>
</element></zeroOrMore>
</define>
<define name="reporef-content">
<attribute name="hlink"><data type="IDREF"/></attribute>
<optional><attribute name="callno"><text/></attribute></optional>
<optional><attribute name="medium"><text/></attribute></optional>
<optional><element name="note">
<ref name="note-content"/>
</element></optional>
<zeroOrMore><element name="noteref">
<ref name="noteref-content"/>
</element></zeroOrMore>
</define>
<define name="noteref-content">
<attribute name="hlink"><data type="IDREF"/></attribute>
</define>
<define name="priv-content">
@ -507,9 +521,9 @@
<zeroOrMore><element name="sourceref">
<ref name="sourceref-content"/>
</element></zeroOrMore>
<optional><element name="note">
<ref name="note-content"/>
</element></optional>
<zeroOrMore><element name="noteref">
<ref name="noteref-content"/>
</element></zeroOrMore>
</define>
<define name="url-content">
@ -532,9 +546,9 @@
<zeroOrMore><element name="sourceref">
<ref name="sourceref-content"/>
</element></zeroOrMore>
<optional><element name="note">
<ref name="note-content"/>
</element></optional>
<zeroOrMore><element name="noteref">
<ref name="noteref-content"/>
</element></zeroOrMore>
</define>
<define name="lds-content">
@ -552,9 +566,9 @@
<optional><element name="sealed_to">
<attribute name="hlink"><data type="IDREF"/></attribute>
</element></optional>
<optional><element name="note">
<ref name="note-content"/>
</element></optional>
<zeroOrMore><element name="noteref">
<ref name="noteref-content"/>
</element></zeroOrMore>
<optional><ref name="date-content"/></optional>
<zeroOrMore><element name="sourceref">
<ref name="sourceref-content"/>

View File

@ -678,12 +678,7 @@ class GrampsDbXmlWriter(object):
else:
self.g.write('<sourceref hlink="%s" conf="%d">\n' % ("_"+source.get_handle(),q))
self.write_line("spage",p,index+1)
# FIXME: Do we really need scomments? One or many?
# Gedcom standard seems to allow normal notes in sourcerefs:
# http://homepages.rootsweb.com/~pmcbride/gedcom/55gcch2.htm#SOURCE_CITATION
self.write_note_list(n,index+1)
# for handle in n:
# self.write_ref("scomments",handle,index+1)
self.write_text("stext",t,index+1)
self.write_date(d,index+1)
self.g.write("%s</sourceref>\n" % (" " * index))