Skip to content

# definitions

## `xsdata.codegen.parsers.definitions`

### `DefinitionsParser` `dataclass`

Bases: `SchemaParser`

Parse a wsdl document into data models.

Source code in `xsdata/codegen/parsers/definitions.py`

    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53

    @dataclass
    class DefinitionsParser(SchemaParser):
        """Parse a wsdl document into data models."""

        def end(
            self,
            queue: list[XmlNode],
            objects: list[Parsed],
            qname: str,
            text: str | None,
            tail: str | None,
        ) -> Any:
            """Parse the last xml node and bind any intermediate objects.

            Override parent method to set source location in every
            wsdl element.

            Args:
                queue: The XmlNode queue list
                objects: The list of all intermediate parsed objects
                qname: The element qualified name
                text: The element text content
                tail: The element tail content

            Returns:
                Whether the binding process was successful.
            """
            obj = super().end(queue, objects, qname, text, tail)
            if isinstance(obj, wsdl.WsdlElement):
                obj.location = self.location

            return obj

        def end_import(self, obj: T) -> None:
            """End import element entrypoint.

            Resolve the location path of import elements.

            Args:
                obj: The wsdl import element.
            """
            if isinstance(obj, wsdl.Import) and self.location:
                obj.location = self.resolve_path(obj.location)

#### `end(queue, objects, qname, text, tail)`

Parse the last xml node and bind any intermediate objects.

Override parent method to set source location in every wsdl element.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`queue` | `list[XmlNode]` | The XmlNode queue list | required
`objects` | `list[Parsed]` | The list of all intermediate parsed objects | required
`qname` | `str` | The element qualified name | required
`text` | `str | None` | The element text content | required
`tail` | `str | None` | The element tail content | required

Returns:

Type | Description
--- | ---
`Any` | Whether the binding process was successful.

Source code in `xsdata/codegen/parsers/definitions.py`

    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42

    def end(
        self,
        queue: list[XmlNode],
        objects: list[Parsed],
        qname: str,
        text: str | None,
        tail: str | None,
    ) -> Any:
        """Parse the last xml node and bind any intermediate objects.

        Override parent method to set source location in every
        wsdl element.

        Args:
            queue: The XmlNode queue list
            objects: The list of all intermediate parsed objects
            qname: The element qualified name
            text: The element text content
            tail: The element tail content

        Returns:
            Whether the binding process was successful.
        """
        obj = super().end(queue, objects, qname, text, tail)
        if isinstance(obj, wsdl.WsdlElement):
            obj.location = self.location

        return obj

#### `end_import(obj)`

End import element entrypoint.

Resolve the location path of import elements.

Parameters:

Name | Type | Description | Default
--- | --- | --- | ---
`obj` | `T` | The wsdl import element. | required

Source code in `xsdata/codegen/parsers/definitions.py`

    44
    45
    46
    47
    48
    49
    50
    51
    52
    53

    def end_import(self, obj: T) -> None:
        """End import element entrypoint.

        Resolve the location path of import elements.

        Args:
            obj: The wsdl import element.
        """
        if isinstance(obj, wsdl.Import) and self.location:
            obj.location = self.resolve_path(obj.location)