Modified Files: Tag: serialize-dom-scheme ZSI/generate/containers.py -- fixed/relaxed attribute typecoding No tag ZSI/wstools/WSDLTools.py -- commented out some useless? code ZSI/wstools/XMLSchema.py -- fix for chameleon includes Tag: serialize-dom-scheme test/wsdl2py/ServiceTest.py test/wsdl2py/config.txt test/wsdl2py/test_OpcDaGateway.py -- added new unittest Added Files: Tag: serialize-dom-scheme test/wsdl2py/test_Sabre.py -- added new unittest ----------------------------------------------------------------------main
@@ -464,25 +464,25 @@ class Message(Element): | |||||
if elemref is not None: | if elemref is not None: | ||||
part.element = ParseTypeRef(elemref, element) | part.element = ParseTypeRef(elemref, element) | ||||
def getElementDeclaration(self): | |||||
"""Return the XMLSchema.ElementDeclaration instance or None""" | |||||
element = None | |||||
if self.element: | |||||
nsuri,name = self.element | |||||
wsdl = self.getWSDL() | |||||
if wsdl.types.has_key(nsuri) and wsdl.types[nsuri].elements.has_key(name): | |||||
element = wsdl.types[nsuri].elements[name] | |||||
return element | |||||
def getTypeDefinition(self): | |||||
"""Return the XMLSchema.TypeDefinition instance or None""" | |||||
type = None | |||||
if self.type: | |||||
nsuri,name = self.type | |||||
wsdl = self.getWSDL() | |||||
if wsdl.types.has_key(nsuri) and wsdl.types[nsuri].types.has_key(name): | |||||
type = wsdl.types[nsuri].types[name] | |||||
return type | |||||
# def getElementDeclaration(self): | |||||
# """Return the XMLSchema.ElementDeclaration instance or None""" | |||||
# element = None | |||||
# if self.element: | |||||
# nsuri,name = self.element | |||||
# wsdl = self.getWSDL() | |||||
# if wsdl.types.has_key(nsuri) and wsdl.types[nsuri].elements.has_key(name): | |||||
# element = wsdl.types[nsuri].elements[name] | |||||
# return element | |||||
# | |||||
# def getTypeDefinition(self): | |||||
# """Return the XMLSchema.TypeDefinition instance or None""" | |||||
# type = None | |||||
# if self.type: | |||||
# nsuri,name = self.type | |||||
# wsdl = self.getWSDL() | |||||
# if wsdl.types.has_key(nsuri) and wsdl.types[nsuri].types.has_key(name): | |||||
# type = wsdl.types[nsuri].types[name] | |||||
# return type | |||||
# def getWSDL(self): | # def getWSDL(self): | ||||
# """Return the WSDL object that contains this Message Part.""" | # """Return the WSDL object that contains this Message Part.""" | ||||
@@ -739,9 +739,16 @@ class XMLSchemaComponent(XMLBase, MarkerInterface): | |||||
raise SchemaError,\ | raise SchemaError,\ | ||||
'class instance %s, missing required attribute %s'\ | 'class instance %s, missing required attribute %s'\ | ||||
%(self.__class__, a) | %(self.__class__, a) | ||||
for a in self.attributes.keys(): | |||||
if (a not in (XMLSchemaComponent.xmlns, XMLNS.XML)) and\ | |||||
(a not in self.__class__.attributes.keys()) and not\ | |||||
for a,v in self.attributes.items(): | |||||
# attribute #other, ie. not in empty namespace | |||||
if type(v) is dict: | |||||
continue | |||||
# predefined prefixes xmlns, xml | |||||
if a in (XMLSchemaComponent.xmlns, XMLNS.XML): | |||||
continue | |||||
if (a not in self.__class__.attributes.keys()) and not\ | |||||
(self.isAttribute() and self.isReference()): | (self.isAttribute() and self.isReference()): | ||||
raise SchemaError, '%s, unknown attribute(%s,%s)' \ | raise SchemaError, '%s, unknown attribute(%s,%s)' \ | ||||
%(self.getItemTrace(), a, self.attributes[a]) | %(self.getItemTrace(), a, self.attributes[a]) | ||||
@@ -1358,7 +1365,12 @@ class XMLSchema(XMLSchemaComponent): | |||||
reader = SchemaReader(base_url=schema.getBaseUrl()) | reader = SchemaReader(base_url=schema.getBaseUrl()) | ||||
reader._imports = schema.getImportSchemas() | reader._imports = schema.getImportSchemas() | ||||
reader._includes = schema.getIncludeSchemas() | reader._includes = schema.getIncludeSchemas() | ||||
self._schema = reader.loadFromURL(url) | |||||
# create schema before loading so chameleon include | |||||
# will evalute targetNamespace correctly. | |||||
self._schema = XMLSchema(schema) | |||||
reader.loadFromURL(url, self._schema) | |||||
return self._schema | return self._schema | ||||