* data/grampsxml.dtd: Update.

* data/grampsxml.rng: Update.


svn: r6366
This commit is contained in:
Alex Roitman 2006-04-19 05:14:37 +00:00
parent 506da3841b
commit 65d8a8e894
5 changed files with 45 additions and 29 deletions

View File

@ -33,6 +33,8 @@
* src/DisplayTabs.py: remove property button stuff
2006-04-18 Alex Roitman <shura@gramps-project.org>
* data/grampsxml.dtd: Update.
* data/grampsxml.rng: Update.
* src/GrampsDb/_ReadXML.py: Parse old and new XML.
* src/GrampsDb/_WriteXML.py (dump_child_ref, dump_person_ref): Add
methods.

View File

@ -93,7 +93,7 @@ PEOPLE
<!ELEMENT person (gender, name*, nick?, eventref*, lds_ord*,
objref*, address*, attribute*, url*,
childof*, parentin*, note?, sourceref*)>
childof*, parentin*, personref*, note?, sourceref*)>
<!ATTLIST person
id CDATA #REQUIRED
handle ID #REQUIRED
@ -130,15 +130,19 @@ GENDER has values of M, F, or U.
<!ELEMENT nick (#PCDATA)>
<!ELEMENT childof EMPTY>
<!ATTLIST childof
hlink IDREF #REQUIRED
mrel (None|Birth|Adopted|Stepchild|Sponsored|Foster|Other|Unknown) #IMPLIED
frel (None|Birth|Adopted|Stepchild|Sponsored|Foster|Other|Unknown) #IMPLIED
<!ATTLIST childof hlink IDREF #REQUIRED
>
<!ELEMENT parentin EMPTY>
<!ATTLIST parentin hlink IDREF #REQUIRED>
<!ELEMENT personref (sourceref*,note?)>
<!ATTLIST personref
hlink IDREF #REQUIRED
priv (0|1) #IMPLIED
rel CDATA #REQUIRED
>
<!ELEMENT address ((daterange|dateval|datestr)?,street?,city?,state?,
country?,postal?,phone?,note?,sourceref?)>
<!ATTLIST address priv (0|1) #IMPLIED>
@ -159,7 +163,7 @@ FAMILY
<!ELEMENT families (family)*>
<!ELEMENT family (rel?,father?,mother?,eventref*,lds_ord*,
objref*,child*,attribute*,note?,sourceref*)>
objref*,childref*,attribute*,note?,sourceref*)>
<!ATTLIST family
id CDATA #REQUIRED
handle ID #REQUIRED
@ -174,8 +178,13 @@ FAMILY
<!ELEMENT mother EMPTY>
<!ATTLIST mother hlink IDREF #REQUIRED>
<!ELEMENT child EMPTY>
<!ATTLIST child hlink IDREF #REQUIRED>
<!ELEMENT childref (sourceref*,note?)>
<!ATTLIST childref
hlink IDREF #REQUIRED
priv (0|1) #IMPLIED
mrel (None|Birth|Adopted|Stepchild|Sponsored|Foster|Other|Unknown) #IMPLIED
frel (None|Birth|Adopted|Stepchild|Sponsored|Foster|Other|Unknown) #IMPLIED
>
<!ELEMENT type (#PCDATA)>

View File

@ -153,16 +153,17 @@
</element></zeroOrMore>
<zeroOrMore><element name="childof">
<attribute name="hlink"><data type="IDREF"/></attribute>
<optional><attribute name="mrel">
<ref name="child-rel"/>
</attribute></optional>
<optional><attribute name="frel">
<ref name="child-rel"/>
</attribute></optional>
</element></zeroOrMore>
<zeroOrMore><element name="parentin">
<attribute name="hlink"><data type="IDREF"/></attribute>
</element></zeroOrMore>
<zeroOrMore><element name="personref">
<attribute name="hlink"><data type="IDREF"/></attribute>
<optional><attribute name="priv">
<ref name="priv-content"/>
</attribute></optional>
<attribute name="rel"><text/></attribute>
</element></zeroOrMore>
<optional><element name="note">
<ref name="note-content"/>
</element></optional>
@ -287,8 +288,17 @@
<zeroOrMore><element name="objref">
<ref name="objref-content"/>
</element></zeroOrMore>
<zeroOrMore><element name="child">
<zeroOrMore><element name="childref">
<attribute name="hlink"><data type="IDREF"/></attribute>
<optional><attribute name="priv">
<ref name="priv-content"/>
</attribute></optional>
<optional><attribute name="mrel">
<ref name="child-rel"/>
</attribute></optional>
<optional><attribute name="frel">
<ref name="child-rel"/>
</attribute></optional>
</element></zeroOrMore>
<zeroOrMore><element name="attribute">
<ref name="attribute-content"/>

View File

@ -956,14 +956,13 @@ class GrampsParser:
mrel = RelLib.ChildRefType().set_from_xml_str(attrs.get('mrel'))
frel = RelLib.ChildRefType().set_from_xml_str(attrs.get('frel'))
# Only need to worry about this if there are non-default rels
# Otherwise, if both are default, the family's child tag will do
if not ( mrel.is_default() and frel.is_default() ):
childref = RelLib.ChildRef()
childref.ref = self.person.handle
childref = RelLib.ChildRef()
childref.ref = self.person.handle
if not mrel.is_default():
childref.set_mother_relation(mrel)
if not frel.is_default():
childref.set_father_relation(frel)
self.childref_map[(handle,self.person.handle)] = childref
self.childref_map[(handle,self.person.handle)] = childref
self.person.add_parent_family_handle(handle)
def start_parentin(self,attrs):
@ -979,8 +978,6 @@ class GrampsParser:
if not self.in_witness:
self.name = RelLib.Name()
self.name.type.set_from_xml_str(attrs.get('type'))
## (_ConstXML.tuple_from_xml(
## _ConstXML.name_types,attrs.get('type','Birth Name')))
self.name.sort_as = int(attrs.get("sort",RelLib.Name.DEF))
self.name.display_as = int(attrs.get("display",RelLib.Name.DEF))
self.name.conf = int(attrs.get("conf",2))

View File

@ -535,10 +535,10 @@ class XmlWriter:
sreflist = childref.get_source_references()
if (len(sreflist) == 0) and childref.get_note() =="":
self.write_ref('childref',childref.ref,index,close=True,
extra_text=priv_text+frel_text+mrel_text)
extra_text=priv_text+mrel_text+frel_text)
else:
self.write_ref('childref',childref.ref,index,close=False,
extra_text=priv_text+frel_text+mrel_text)
extra_text=priv_text+mrel_text+frel_text)
for sref in sreflist:
self.dump_source_ref(sref,index+1)
self.write_note("note",childref.get_note_object(),index+1)
@ -759,8 +759,7 @@ class XmlWriter:
def dump_name(self,name,alternative=False,index=1):
sp = " "*index
name_type = _ConstXML.str_for_xml(_ConstXML.name_types,
name.get_type())
name_type = name.get_type().xml_str()
self.g.write('%s<name' % sp)
if alternative:
self.g.write(' alt="1"')
@ -923,8 +922,7 @@ class XmlWriter:
def write_url_list(self,list,index=1):
sp = " "*index
for url in list:
url_type = _ConstXML.str_for_xml(_ConstXML.url_types,
url.get_type())
url_type = url.get_type().xml_str()
if url_type:
type_text = ' type="%s"' % url_type
else: