Browse Source

----------------------------------------------------------------------

Modified Files:
 	XMLSchema.py -- fixed bug with xsd:import w/o schemaLocation.
		This bug may have been introduced with recursive import fix.

 ----------------------------------------------------------------------
main
Joshua Boverhof 19 years ago
parent
commit
12310fb909
1 changed files with 14 additions and 33 deletions
  1. +14
    -33
      XMLSchema.py

+ 14
- 33
XMLSchema.py View File

@@ -1162,7 +1162,17 @@ class XMLSchema(XMLSchemaComponent):
if schema is None: if schema is None:
schema = XMLSchema() schema = XMLSchema()
slocd[import_ns] = schema slocd[import_ns] = schema
tp.loadSchema(schema)
try:
tp.loadSchema(schema)
except SchemaError:
# Dependency declaration, hopefully implementation
# is aware of this namespace (eg. SOAP,WSDL,?)
warnings.warn(\
'<import namespace="%s" schemaLocation=?>, %s'\
%(import_ns, 'failed to load schema instance')
)
del slocd[import_ns]
continue
else: else:
tp._schema = schema tp._schema = schema
@@ -1211,38 +1221,6 @@ class XMLSchema(XMLSchemaComponent):
else: else:
break break


# slocd = SchemaReader.namespaceToSchema
#
# print "XMLSchema(%d): %s" %(id(self), self.targetNamespace)
#
# for node in imports:
# tp = self.__class__.Import(self)
# tp.fromDom(node)
#
# import_ns = tp.getAttribute('namespace') or \
# self.__class__.empty_namespace
#
# print "<import namespace=%s>" %import_ns
#
# schema = slocd.get(import_ns)
# if schema is None:
# schema = XMLSchema()
# slocd[import_ns] = schema
# tp.loadSchema(schema)
# else:
# tp._schema = schema
#
# if self.getImportSchemas().has_key(import_ns):
# warnings.warn(\
# 'Detected multiple imports of the namespace "%s",'+
# 'may cause problems if they have different schemaLocations.' %import_ns
# )
# raise RuntimeError, 'hi'
#
# self.addImportSchema(schema)
# self.imports[import_ns] = tp


class Import(XMLSchemaComponent): class Import(XMLSchemaComponent):
"""<import> """<import>
parent: parent:
@@ -1310,6 +1288,9 @@ class XMLSchema(XMLSchemaComponent):
reader._imports = self._parent().getImportSchemas() reader._imports = self._parent().getImportSchemas()
reader._includes = self._parent().getIncludeSchemas() reader._includes = self._parent().getIncludeSchemas()
self._schema = schema self._schema = schema

if not self.attributes.has_key('schemaLocation'):
raise SchemaError, 'no schemaLocation'
reader.loadFromURL(self.attributes.get('schemaLocation'), schema) reader.loadFromURL(self.attributes.get('schemaLocation'), schema)






Loading…
Cancel
Save