From 17ae9bc55f9bdecaecac87f80983f4503963a3d6 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 28 Aug 2020 12:55:06 +0300 Subject: [PATCH] Fix #238 Remove all other attrs when mix content attr is present Notes: That's my worst case solution... I want to resolve this in the xml nodes but that seems tricky --- xsdata/codegen/handlers/attribute_mismatch.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xsdata/codegen/handlers/attribute_mismatch.py b/xsdata/codegen/handlers/attribute_mismatch.py index db379c623..f411aa6fe 100644 --- a/xsdata/codegen/handlers/attribute_mismatch.py +++ b/xsdata/codegen/handlers/attribute_mismatch.py @@ -32,3 +32,10 @@ def process(cls, target: Class): enumerations = [attr for attr in target.attrs if attr.is_enumeration] if len(enumerations) > 0: target.attrs = enumerations + + mixed_content = next((attr for attr in target.attrs if attr.mixed), None) + if mixed_content: + target.attrs.clear() + target.attrs.append(mixed_content) + + target.inner.clear()