Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixed content tail is added twice #256

Closed
tefra opened this issue Sep 13, 2020 · 0 comments
Closed

Mixed content tail is added twice #256

tefra opened this issue Sep 13, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@tefra
Copy link
Owner

tefra commented Sep 13, 2020

This is a complex case but the new serialize writers brought this to my attention

@dataclass
class A:

    any_element: Optional[object] = field(
        default=None,
        metadata=dict(
            type="Wildcard",
            namespace="##any",
            required=True
        )
    )


@dataclass
class Root:
    class Meta:
        name = "root"
        namespace = "foo"

    mixed: List["Root.Mixed"] = field(
        default_factory=list,
        metadata=dict(
            type="Element",
            min_occurs=0,
            max_occurs=9223372036854775807
        )
    )

    @dataclass
    class Mixed:
        content: List[object] = field(
            default_factory=list,
            metadata=dict(
                type="Wildcard",
                namespace="##any",
                mixed=True,
                min_occurs=0,
                max_occurs=9223372036854775807
            )
        )
        a: List[A] = field(
            default_factory=list,
            metadata=dict(
                type="Element",
                min_occurs=0,
                max_occurs=9223372036854775807
            )
        )
<root xmlns="foo">
	<mixed>
		<a /> mi
	</mixed>
</root>
Root(
    mixed=[
        Root.Mixed(content=[
            A(any_element=AnyElement(qname=None, text=None, tail=' mi ', s_map={None: 'foo'})),
            ' mi ',
        ])
    ]
)

The binding node, allows the tail to be added to both the generic object and to the content list. I feel sorry for anyone working with schemas like this but yeah.

@tefra tefra added the bug Something isn't working label Sep 13, 2020
tefra added a commit that referenced this issue Sep 13, 2020
tefra added a commit that referenced this issue Sep 13, 2020
@tefra tefra closed this as completed in 6703665 Sep 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant