[Python-modules-commits] [python-odf] 32/118: Fixed the mistakes in the v. 1.0 schema
Wolfgang Borgert
debacle at moszumanska.debian.org
Fri Oct 3 21:27:19 UTC 2014
This is an automated email from the git hooks/post-receive script.
debacle pushed a commit to reference refs/remotes/upstream/master
in repository python-odf.
commit 020dbeee98763576db32091bbe9b337f32f889f1
Author: Søren Roug <soren.roug at eea.europa.eu>
Date: Sun Jan 4 19:43:41 2009 +0000
Fixed the mistakes in the v. 1.0 schema
---
grammar/OpenDocument-schema-v1.0-os.rng | 6 +++++
grammar/gen_allowed_children.py | 41 ++++++++++++++++++---------------
2 files changed, 28 insertions(+), 19 deletions(-)
diff --git a/grammar/OpenDocument-schema-v1.0-os.rng b/grammar/OpenDocument-schema-v1.0-os.rng
index 7c5cb42..493d780 100644
--- a/grammar/OpenDocument-schema-v1.0-os.rng
+++ b/grammar/OpenDocument-schema-v1.0-os.rng
@@ -548,6 +548,9 @@
<optional>
<ref name="draw-layer-set"/>
</optional>
+ <optional>
+ <ref name="table-table-template"/>
+ </optional>
</interleave>
</element>
</optional>
@@ -10779,6 +10782,9 @@
<ref name="common-anim-attlist"/>
<ref name="common-endsync-timing-attlist"/>
<ref name="common-timing-attlist"/>
+ <zeroOrMore>
+ <ref name="animation-element"/>
+ </zeroOrMore>
</element>
</define>
<define name="animation-element" combine="choice">
diff --git a/grammar/gen_allowed_children.py b/grammar/gen_allowed_children.py
index adf825b..cf199e9 100755
--- a/grammar/gen_allowed_children.py
+++ b/grammar/gen_allowed_children.py
@@ -69,6 +69,7 @@ class S22RelaxParser(handler.ContentHandler):
if tag == (RELAXNS, 'define'):
self.currdef = {}
self.currdef['refs'] = []
+ self.currdef['elements'] = []
self.currdef['name'] = attrs.get( (None, 'name'))
elif tag in ((RELAXNS, 'attribute'), (RELAXNS, 'start')):
self.ignore = 1
@@ -88,12 +89,12 @@ class S22RelaxParser(handler.ContentHandler):
return
#print "END ",tag
if tag == (RELAXNS, 'define'):
- if self.currdef.has_key('element'):
+ if len(self.currdef['elements']):
self.definitions[self.currdef['name']] = self.currdef
elif tag == (RELAXNS, 'name'):
- self.currdef['element'] = self.text()
+ self.currdef['elements'].append(self.text())
elif tag == (RELAXNS, 'anyName'):
- self.currdef['element'] = "__ANYNAME__"
+ self.currdef['elements'].append("__ANYNAME__")
self.data = []
if __name__ == "__main__":
@@ -110,8 +111,8 @@ if __name__ == "__main__":
inpsrc.setByteStream(content)
parser.parse(inpsrc)
- defs = p.definitions
- keys= defs.keys()
+ definitions = p.definitions
+ keys= definitions.keys()
keys.sort()
print '''# -*- coding: utf-8 -*-
# Copyright (C) 2006-2008 Søren Roug, European Environment Agency
@@ -142,18 +143,20 @@ from odf.namespaces import *'''
print "allowed_children = {"
for key in keys:
- val = defs[key]
- if val['element'] == u'__ANYNAME__':
- continue
- ns = val.get('ns','UNKNOWN')
- refs = val['refs']
- if len(refs) == 1 and defs[refs[0]]['element'] == u'__ANYNAME__':
- print "\t(%sNS,u'%s') : " % (nsdict.get(ns,'unknown').upper(), val['element'])
- print "\t\tNone,"
- else:
- print "\t(%sNS,u'%s') : (" % (nsdict.get(ns,'unknown').upper(), val['element'])
- for r in refs:
- ns = defs[r].get('ns','UNKNOWN')
- print "\t\t(%sNS,u'%s'), " % (nsdict.get(ns,'unknown').upper(), defs[r]['element'])
- print "\t),"
+ definition = definitions[key]
+ for elmname in definition['elements']:
+ if elmname == u'__ANYNAME__':
+ continue
+ ns = definition.get('ns','UNKNOWN')
+ refs = definition['refs']
+ if len(refs) == 1 and u'__ANYNAME__' in definitions[refs[0]]['elements']:
+ print "\t(%sNS,u'%s') : " % (nsdict.get(ns,'unknown').upper(), elmname)
+ print "\t\tNone,"
+ else:
+ print "\t(%sNS,u'%s') : (" % (nsdict.get(ns,'unknown').upper(), elmname)
+ for r in refs:
+ ns = definitions[r].get('ns','UNKNOWN')
+ for elmref in definitions[r]['elements']:
+ print "\t\t(%sNS,u'%s'), " % (nsdict.get(ns,'unknown').upper(), elmref)
+ print "\t),"
print "}"
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-odf.git
More information about the Python-modules-commits
mailing list