def _get_schema_documents(self, namespace, fail_silently=False): if namespace not in self._documents: if fail_silently: return [] raise exceptions.NamespaceError( "No schema available for the namespace %r" % namespace) return self._documents[namespace]
def get_attribute_group(self, qname): """Return a global xsd.attributeGroup object with the given qname""" qname = self._create_qname(qname) try: schema = self._get_schema_document(qname.namespace) return schema.get_attribute_group(qname) except exceptions.NamespaceError: raise exceptions.NamespaceError( ("Unable to resolve attributeGroup %s. " + "No schema available for the namespace %r.") % (qname.text, qname.namespace))
def _get_schema_documents(self, namespace, fail_silently=False): """Return a list of SchemaDocument's for the given namespace. :rtype: list of SchemaDocument """ if namespace not in self._documents: if fail_silently: return [] raise exceptions.NamespaceError( "No schema available for the namespace %r" % namespace) return self._documents[namespace]
def _get_schema_documents(self, namespace, fail_silently=False): """Return a list of SchemaDocument's for the given namespace. :rtype: list of SchemaDocument """ if (namespace not in self._documents and namespace in const.AUTO_IMPORT_NAMESPACES): logger.debug("Auto importing missing known schema: %s", namespace) self.add_document_by_url(namespace) if namespace not in self._documents: if fail_silently: return [] raise exceptions.NamespaceError( "No schema available for the namespace %r" % namespace) return self._documents[namespace]
def get_type(self, qname): """Return a global xsd.Type object with the given qname""" qname = self._create_qname(qname) # Handle XSD namespace items if qname.namespace == const.NS_XSD: try: return xsd_builtins.default_types[qname] except KeyError: raise exceptions.LookupError("No such type %r" % qname.text) try: schema = self._get_schema_document(qname.namespace) return schema.get_type(qname) except exceptions.NamespaceError: raise exceptions.NamespaceError( ("Unable to resolve type %s. " + "No schema available for the namespace %r.") % (qname.text, qname.namespace))