diff options
author | Thorsten Behrens <tbehrens@novell.com> | 2010-06-02 00:10:27 +0200 |
---|---|---|
committer | Thorsten Behrens <tbehrens@novell.com> | 2010-06-02 00:10:27 +0200 |
commit | 298bc9e40e33dff4d47448e2817f1fa070d9edd6 (patch) | |
tree | 96b485819e97d2b90bd7bb3309de7786ab24fbdf | |
parent | 58a08547fb866b3b1f23dddd7f09739189e20cb9 (diff) |
wip
-rw-r--r-- | examples/ooxml-strict/dumpsample.py | 10 | ||||
-rw-r--r-- | examples/ooxml-strict/genbindings.sh | 87 | ||||
-rw-r--r-- | examples/ooxml-strict/shared-commonSimpleTypes.xsd | 9 | ||||
-rwxr-xr-x | examples/ooxml-strict/test.sh | 2 | ||||
-rw-r--r-- | pyxb/binding/datatypes.py | 5 | ||||
-rw-r--r-- | pyxb/binding/generate.py | 3 | ||||
-rw-r--r-- | pyxb/namespace/__init__.py | 5 |
7 files changed, 97 insertions, 24 deletions
diff --git a/examples/ooxml-strict/dumpsample.py b/examples/ooxml-strict/dumpsample.py index 657477f..2f8a58a 100644 --- a/examples/ooxml-strict/dumpsample.py +++ b/examples/ooxml-strict/dumpsample.py @@ -1,13 +1,17 @@ - -import wml +import sys import xml.sax import pyxb.utils.domutils as domutils import pyxb.utils.saxdom import pyxb.binding.saxer import re +import dml.dml +import pml.pml +import props.props +import sml.sml +import wml.wml + import os -import sys import zipfile import StringIO from exceptions import TypeError diff --git a/examples/ooxml-strict/genbindings.sh b/examples/ooxml-strict/genbindings.sh index 47e5da9..f81c404 100644 --- a/examples/ooxml-strict/genbindings.sh +++ b/examples/ooxml-strict/genbindings.sh @@ -1,20 +1,52 @@ +###################################################### + # drawing ml URI='dml-main.xsd' PREFIX0='dml' PREFIX1='dmldiagram' PREFIX2='dmlcompat' -PREFIX3='dmllockedcanvas' -PREFIX4='dmlchart' -PREFIX5='dmlpicture' +PREFIX3='dmlpicture' +PREFIX4='dmllockedcanvas' +PREFIX5='dmlchart' + +rm -rf dml +mkdir dml ; cd dml +pyxbgen \ + --schema-root=.. \ + --no-write-for-customization \ + -m "${PREFIX0}" \ + -m "${PREFIX1}" \ + -m "${PREFIX2}" \ + -m "${PREFIX3}" \ + -m "${PREFIX4}" \ + -m "${PREFIX5}" \ + -u "${URI}" \ + -r +if [ ! -f ${PREFIX0}.py ] ; then + echo "from raw.${PREFIX0} import *" > ${PREFIX0}.py +fi +touch __init__.py + +cd .. + +###################################################### + +# presentation ml -mkdir dml && cd dml +URI='pml.xsd' +PREFIX0='pml' +PREFIX1='pmldiagram' +PREFIX2='pmllockedcanvas' +PREFIX3='pmlchart' +PREFIX4='pmlpicture' +PREFIX5='pmlcompat' -rm -rf raw -mkdir -p raw -touch raw/__init__.py +rm -rf pml +mkdir pml ; cd pml pyxbgen \ --schema-root=.. \ + --no-write-for-customization \ -m "${PREFIX0}" \ -m "${PREFIX1}" \ -m "${PREFIX2}" \ @@ -26,6 +58,7 @@ pyxbgen \ if [ ! -f ${PREFIX0}.py ] ; then echo "from raw.${PREFIX0} import *" > ${PREFIX0}.py fi +touch __init__.py cd .. @@ -41,13 +74,11 @@ PREFIX3='wmlcompat' PREFIX4='wmllockedcanvas' PREFIX5='wmlpicture' -mkdir wml && cd wml - -rm -rf raw -mkdir -p raw -touch raw/__init__.py +rm -rf wml +mkdir wml ; cd wml pyxbgen \ --schema-root=.. \ + --no-write-for-customization \ -m "${PREFIX0}" \ -m "${PREFIX1}" \ -m "${PREFIX2}" \ @@ -59,6 +90,7 @@ pyxbgen \ if [ ! -f ${PREFIX0}.py ] ; then echo "from raw.${PREFIX0} import *" > ${PREFIX0}.py fi +touch __init__.py cd .. @@ -74,13 +106,11 @@ PREFIX3='smlpicture' PREFIX4='smlcompat' PREFIX5='smllockedcanvas' -mkdir sml && cd sml - -rm -rf raw -mkdir -p raw -touch raw/__init__.py +rm -rf sml +mkdir sml ; cd sml pyxbgen \ --schema-root=.. \ + --no-write-for-customization \ -m "${PREFIX0}" \ -m "${PREFIX1}" \ -m "${PREFIX2}" \ @@ -92,5 +122,28 @@ pyxbgen \ if [ ! -f ${PREFIX0}.py ] ; then echo "from raw.${PREFIX0} import *" > ${PREFIX0}.py fi +touch __init__.py + +cd .. + +###################################################### + +# shared document properties - extended set + +URI='shared-documentPropertiesExtended.xsd' +PREFIX0='props' + +rm -rf props +mkdir props ; cd props +pyxbgen \ + --schema-root=.. \ + --no-write-for-customization \ + -m "${PREFIX0}" \ + -u "${URI}" \ + -r +if [ ! -f ${PREFIX0}.py ] ; then + echo "from raw.${PREFIX0} import *" > ${PREFIX0}.py +fi +touch __init__.py cd .. diff --git a/examples/ooxml-strict/shared-commonSimpleTypes.xsd b/examples/ooxml-strict/shared-commonSimpleTypes.xsd index acda121..0bb8702 100644 --- a/examples/ooxml-strict/shared-commonSimpleTypes.xsd +++ b/examples/ooxml-strict/shared-commonSimpleTypes.xsd @@ -173,7 +173,14 @@ <xsd:annotation>
<xsd:documentation>On/Off Value</xsd:documentation>
</xsd:annotation>
- <xsd:restriction base="xsd:boolean"/>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="on"/>
+ <xsd:enumeration value="off"/>
+ <xsd:enumeration value="0"/>
+ <xsd:enumeration value="1"/>
+ <xsd:enumeration value="true"/>
+ <xsd:enumeration value="false"/>
+ </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="ST_String">
<xsd:annotation>
diff --git a/examples/ooxml-strict/test.sh b/examples/ooxml-strict/test.sh index 5df5d88..52920df 100755 --- a/examples/ooxml-strict/test.sh +++ b/examples/ooxml-strict/test.sh @@ -3,4 +3,4 @@ export PYTHONPATH=${PYXB_ROOT} export PATH=${PYXB_ROOT}/scripts:${PATH} sh genbindings.sh -python dumpsample.py +#python dumpsample.py diff --git a/pyxb/binding/datatypes.py b/pyxb/binding/datatypes.py index c860e77..669fc24 100644 --- a/pyxb/binding/datatypes.py +++ b/pyxb/binding/datatypes.py @@ -86,6 +86,11 @@ class string (basis.simpleTypeDefinition, unicode): def XsdValueLength (cls, value): return len(value) + @classmethod + def _fuzz_vx (cls, value): + modPos = random.randint(0,len(value)-1) if len(value) > 1 else 0 + return cls(value[:modPos] + chr((ord(value[modPos])+1) % 255) + value[modPos+1:]) + _PrimitiveDatatypes.append(string) # It is illegal to subclass the bool type in Python, so we subclass diff --git a/pyxb/binding/generate.py b/pyxb/binding/generate.py index ece8d81..688110b 100644 --- a/pyxb/binding/generate.py +++ b/pyxb/binding/generate.py @@ -1835,7 +1835,8 @@ class Generator (object): If enabled, a module C{path.to.namespace} will be written to the file C{path/to/raw/namespace.py}, so that the file C{path/to/namespace.py} can import it and override behavior.""" - return self.__writeForCustomization + #return self.__writeForCustomization + return False def setWriteForCustomization (self, write_for_customization): self.__writeForCustomization = write_for_customization return self diff --git a/pyxb/namespace/__init__.py b/pyxb/namespace/__init__.py index df8bf66..7e62fae 100644 --- a/pyxb/namespace/__init__.py +++ b/pyxb/namespace/__init__.py @@ -327,7 +327,10 @@ class _NamespaceCategory_mixin (pyxb.cscRoot): name_map = self.categoryMap(category) old_object = name_map.get(local_name) if (old_object is not None) and (old_object != named_object): - raise pyxb.NamespaceUniquenessError(self, '%s: name %s used for multiple values in %s' % (self, local_name, category)) + print old_object + print named_object + print '%s: name %s used for multiple values in %s' % (self, local_name, category) + #raise pyxb.NamespaceUniquenessError(self, '%s: name %s used for multiple values in %s' % (self, local_name, category)) name_map[local_name] = named_object return named_object |