4209: XML DTD rewrite, cleanup

svn: r17648
This commit is contained in:
Michiel Nauta 2011-06-01 21:33:49 +00:00
parent f8c7e748c7
commit 5d467fc7ea
5 changed files with 599 additions and 480 deletions

View File

@ -107,7 +107,7 @@ PEOPLE
objref*, address*, attribute*, url*, childof*, objref*, address*, attribute*, url*, childof*,
parentin*, personref*, noteref*, sourceref*, tagref*)> parentin*, personref*, noteref*, sourceref*, tagref*)>
<!ATTLIST person <!ATTLIST person
id CDATA #REQUIRED id CDATA #IMPLIED
handle ID #REQUIRED handle ID #REQUIRED
priv (0|1) #IMPLIED priv (0|1) #IMPLIED
marker CDATA #IMPLIED marker CDATA #IMPLIED
@ -182,7 +182,7 @@ FAMILY
<!ELEMENT family (rel?, father?, mother?, eventref*, lds_ord*, objref*, <!ELEMENT family (rel?, father?, mother?, eventref*, lds_ord*, objref*,
childref*, attribute*, noteref*, sourceref*, tagref*)> childref*, attribute*, noteref*, sourceref*, tagref*)>
<!ATTLIST family <!ATTLIST family
id CDATA #REQUIRED id CDATA #IMPLIED
handle ID #REQUIRED handle ID #REQUIRED
priv (0|1) #IMPLIED priv (0|1) #IMPLIED
marker CDATA #IMPLIED marker CDATA #IMPLIED
@ -216,7 +216,7 @@ EVENT
<!ELEMENT event (type?, (daterange|datespan|dateval|datestr)?, place?, cause?, <!ELEMENT event (type?, (daterange|datespan|dateval|datestr)?, place?, cause?,
description?, attribute*, noteref*, sourceref*, objref*)> description?, attribute*, noteref*, sourceref*, objref*)>
<!ATTLIST event <!ATTLIST event
id CDATA #REQUIRED id CDATA #IMPLIED
handle ID #REQUIRED handle ID #REQUIRED
priv (0|1) #IMPLIED priv (0|1) #IMPLIED
marker CDATA #IMPLIED marker CDATA #IMPLIED
@ -231,7 +231,7 @@ SOURCES
<!ELEMENT source (stitle?, sauthor?, spubinfo?, sabbrev?, <!ELEMENT source (stitle?, sauthor?, spubinfo?, sabbrev?,
noteref*, objref*, data_item*, reporef*)> noteref*, objref*, data_item*, reporef*)>
<!ATTLIST source <!ATTLIST source
id CDATA #REQUIRED id CDATA #IMPLIED
handle ID #REQUIRED handle ID #REQUIRED
priv (0|1) #IMPLIED priv (0|1) #IMPLIED
marker CDATA #IMPLIED marker CDATA #IMPLIED
@ -251,7 +251,7 @@ PLACES
<!ELEMENT placeobj (ptitle?, coord?, location*, objref*, url*, noteref*, <!ELEMENT placeobj (ptitle?, coord?, location*, objref*, url*, noteref*,
sourceref*)> sourceref*)>
<!ATTLIST placeobj <!ATTLIST placeobj
id CDATA #REQUIRED id CDATA #IMPLIED
handle ID #REQUIRED handle ID #REQUIRED
priv (0|1) #IMPLIED priv (0|1) #IMPLIED
marker CDATA #IMPLIED marker CDATA #IMPLIED
@ -287,7 +287,7 @@ OBJECTS
<!ELEMENT object (file, attribute*, noteref*, <!ELEMENT object (file, attribute*, noteref*,
(daterange|datespan|dateval|datestr)?, sourceref*, tagref*)> (daterange|datespan|dateval|datestr)?, sourceref*, tagref*)>
<!ATTLIST object <!ATTLIST object
id CDATA #REQUIRED id CDATA #IMPLIED
handle ID #REQUIRED handle ID #REQUIRED
priv (0|1) #IMPLIED priv (0|1) #IMPLIED
marker CDATA #IMPLIED marker CDATA #IMPLIED
@ -309,7 +309,7 @@ REPOSITORIES
<!ELEMENT repository (rname, type, address*, url*, noteref*)> <!ELEMENT repository (rname, type, address*, url*, noteref*)>
<!ATTLIST repository <!ATTLIST repository
id CDATA #REQUIRED id CDATA #IMPLIED
handle ID #REQUIRED handle ID #REQUIRED
priv (0|1) #IMPLIED priv (0|1) #IMPLIED
marker CDATA #IMPLIED marker CDATA #IMPLIED
@ -326,7 +326,7 @@ NOTES
<!ELEMENT note (text, style*, tagref*)> <!ELEMENT note (text, style*, tagref*)>
<!ATTLIST note <!ATTLIST note
id CDATA #REQUIRED id CDATA #IMPLIED
handle ID #REQUIRED handle ID #REQUIRED
priv (0|1) #IMPLIED priv (0|1) #IMPLIED
marker CDATA #IMPLIED marker CDATA #IMPLIED

View File

@ -143,7 +143,7 @@
<define name="primary-object"> <define name="primary-object">
<ref name="table-object"/> <ref name="table-object"/>
<attribute name="id"><text/></attribute> <optional><attribute name="id"><text/></attribute></optional>
<optional><attribute name="priv"><choice> <optional><attribute name="priv"><choice>
<value>0</value> <value>0</value>
<value>1</value> <value>1</value>

View File

@ -121,7 +121,7 @@ class BaseMergeCheck(unittest.TestCase):
def do_test(self, phoenix_id, titanic_id, input_doc, expect_doc, def do_test(self, phoenix_id, titanic_id, input_doc, expect_doc,
test_error_str='', debug=False): test_error_str='', debug=False):
"""Do the merge and "assert" the result.""" """Do the merge and "assert" the result."""
process = subprocess.Popen('python gramps.py ' process = subprocess.Popen('python gramps.py -d .ImportXML '
'--config=preferences.eprefix:DEFAULT ' '--config=preferences.eprefix:DEFAULT '
'-i - -f gramps -a tool ' '-i - -f gramps -a tool '
'-p "name=climerge,primary=%s,secondary=%s" ' '-p "name=climerge,primary=%s,secondary=%s" '
@ -143,7 +143,7 @@ class BaseMergeCheck(unittest.TestCase):
def do_family_test(self, phoenix_id, titanic_id, father_h, mother_h, def do_family_test(self, phoenix_id, titanic_id, father_h, mother_h,
input_doc, expect_doc, test_error_str='', debug=False): input_doc, expect_doc, test_error_str='', debug=False):
process = subprocess.Popen('python gramps.py ' process = subprocess.Popen('python gramps.py -d .ImportXML '
'--config=preferences.eprefix:DEFAULT ' '--config=preferences.eprefix:DEFAULT '
'-i - -f gramps -a tool ' '-i - -f gramps -a tool '
'-p "name=climerge,primary=%s,secondary=%s,father_h=%s,mother_h=%s" ' '-p "name=climerge,primary=%s,secondary=%s,father_h=%s,mother_h=%s" '
@ -165,7 +165,7 @@ class BaseMergeCheck(unittest.TestCase):
def raw_contains(self, phoenix_id, titanic_id, input_doc, expect_str, def raw_contains(self, phoenix_id, titanic_id, input_doc, expect_str,
test_error_str='', debug=False): test_error_str='', debug=False):
process = subprocess.Popen('python gramps.py ' process = subprocess.Popen('python gramps.py -d .ImportXML '
'--config=preferences.eprefix:DEFAULT ' '--config=preferences.eprefix:DEFAULT '
'-i - -f gramps -a tool ' '-i - -f gramps -a tool '
'-p "name=climerge,primary=%s,secondary=%s" ' '-p "name=climerge,primary=%s,secondary=%s" '

View File

@ -1076,7 +1076,7 @@ class DbBsddbRead(DbReadBase, Callback):
str_prefix = pattern_match.group(1) str_prefix = pattern_match.group(1)
nr_width = pattern_match.group(2) nr_width = pattern_match.group(2)
def closure_func(gramps_id): def closure_func(gramps_id):
if gramps_id.startswith(str_prefix): if gramps_id and gramps_id.startswith(str_prefix):
id_number = gramps_id[len(str_prefix):] id_number = gramps_id[len(str_prefix):]
if id_number.isdigit(): if id_number.isdigit():
id_value = int(id_number, 10) id_value = int(id_number, 10)

File diff suppressed because it is too large Load Diff