Beispiel #1
0
    def __init__(self, node, transport, location, parser_context, base_url):
        logger.debug("Init schema for %r", location)
        assert node is not None
        assert parser_context

        # Internal
        self._base_url = base_url or location
        self._location = location
        self._transport = transport
        self._target_namespace = (node.get('targetNamespace')
                                  if node is not None else None)
        self._elm_instances = []

        self._types = {}
        self._elements = {}
        self._attributes = {}
        self._groups = {}

        self._imports = OrderedDict()
        self._element_form = 'unqualified'
        self._attribute_form = 'unqualified'
        self._resolved = False
        # self._xml_schema = None

        parser_context.schema_objects.add(self)

        if node is not None:
            # Disable XML schema validation for now
            # if len(node) > 0:
            #     self.xml_schema = etree.XMLSchema(node)

            visitor = SchemaVisitor(self, parser_context)
            visitor.visit_schema(node)
Beispiel #2
0
    def __init__(self, node, transport, location, parser_context, base_url):
        logger.debug("Init schema for %r", location)
        assert node is not None
        assert parser_context

        # Internal
        self._base_url = base_url or location
        self._location = location
        self._transport = transport
        self._target_namespace = (
            node.get('targetNamespace') if node is not None else None)
        self._elm_instances = []
        self._types = {}
        self._elements = {}
        self._attributes = {}
        self._imports = OrderedDict()
        self._element_form = 'unqualified'
        self._attribute_form = 'unqualified'
        self._resolved = False
        # self._xml_schema = None

        parser_context.schema_objects.add(self)

        if node is not None:
            # Disable XML schema validation for now
            # if len(node) > 0:
            #     self.xml_schema = etree.XMLSchema(node)

            visitor = SchemaVisitor(self, parser_context)
            visitor.visit_schema(node)
Beispiel #3
0
    def load(self, schema, node):
        if node is None:
            return

        if not schema._has_schema_document(self._target_namespace):
            raise RuntimeError(
                "The document needs to be registered in the schema before " +
                "it can be loaded")

        # Disable XML schema validation for now
        # if len(node) > 0:
        #     self.xml_schema = etree.XMLSchema(node)
        visitor = SchemaVisitor(schema, self)
        visitor.visit_schema(node)
Beispiel #4
0
    def __init__(self,
                 node=None,
                 transport=None,
                 location=None,
                 parser_context=None,
                 base_url=None):
        logger.debug("Init schema for %r", location)

        # Internal
        self._base_url = base_url or location
        self._location = location
        self._transport = transport
        self._target_namespace = None
        self._elm_instances = []
        self._types = {}
        self._elements = {}
        self._attributes = {}
        self._imports = OrderedDict()
        self._prefix_map = {}
        self._xml_schema = None
        self._element_form = 'unqualified'
        self._attribute_form = 'unqualified'

        is_root_schema = False
        if not parser_context:
            parser_context = ParserContext()
        if not parser_context.schema_objects:
            is_root_schema = True
        parser_context.schema_objects.add(self)

        if node is not None:
            # Disable XML schema validation for now
            # if len(node) > 0:
            #     self.xml_schema = etree.XMLSchema(node)

            visitor = SchemaVisitor(self, parser_context)
            visitor.visit_schema(node)

        if is_root_schema:
            for schema in self._imports.values():
                schema.resolve()
            self.resolve()
            self._prefix_map = self.create_prefix_map()
Beispiel #5
0
    def load(self, schema, node):
        """Load the XML Schema passed in via the node attribute.

        :type schema: zeep.xsd.schema.Schema
        :type node: etree._Element

        """
        if node is None:
            return

        if not schema.documents.has_schema_document_for_ns(self._target_namespace):
            raise RuntimeError(
                "The document needs to be registered in the schema before " +
                "it can be loaded")

        # Disable XML schema validation for now
        # if len(node) > 0:
        #     self.xml_schema = etree.XMLSchema(node)
        visitor = SchemaVisitor(schema, self)
        visitor.visit_schema(node)
Beispiel #6
0
    def load(self, schema, node):
        """Load the XML Schema passed in via the node attribute.

        :type schema: zeep.xsd.schema.Schema
        :type node: etree._Element

        """
        if node is None:
            return

        if not schema.documents.has_schema_document_for_ns(self._target_namespace):
            raise RuntimeError(
                "The document needs to be registered in the schema before " +
                "it can be loaded")

        # Disable XML schema validation for now
        # if len(node) > 0:
        #     self.xml_schema = etree.XMLSchema(node)
        visitor = SchemaVisitor(schema, self)
        visitor.visit_schema(node)
Beispiel #7
0
    def __init__(self, node=None, transport=None, location=None,
                 parser_context=None, base_url=None):
        logger.debug("Init schema for %r", location)

        # Internal
        self._base_url = base_url or location
        self._location = location
        self._transport = transport
        self._target_namespace = None
        self._elm_instances = []
        self._types = {}
        self._elements = {}
        self._attributes = {}
        self._imports = OrderedDict()
        self._prefix_map = {}
        self._xml_schema = None
        self._element_form = 'unqualified'
        self._attribute_form = 'unqualified'

        is_root_schema = False
        if not parser_context:
            parser_context = ParserContext()
        if not parser_context.schema_objects:
            is_root_schema = True
        parser_context.schema_objects.add(self)

        if node is not None:
            # Disable XML schema validation for now
            # if len(node) > 0:
            #     self.xml_schema = etree.XMLSchema(node)

            visitor = SchemaVisitor(self, parser_context)
            visitor.visit_schema(node)

        if is_root_schema:
            for schema in self._imports.values():
                schema.resolve()
            self.resolve()
            self._prefix_map = self.create_prefix_map()