Skip to content

Commit

Permalink
Fix #238 Remove all other attrs when mix content attr is present
Browse files Browse the repository at this point in the history
Notes:
That's my worst case solution... I want to resolve this in
the xml nodes but that seems tricky
  • Loading branch information
tefra committed Aug 28, 2020
1 parent 492b471 commit 17ae9bc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions xsdata/codegen/handlers/attribute_mismatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 17ae9bc

Please sign in to comment.