Remove/Don't create empty XML tags #3531
Unanswered
WalronGabor
asked this question in
Q&A
Replies: 2 comments
-
I think this is the same as: |
Beta Was this translation helpful? Give feedback.
0 replies
-
You might be able to resolve this using source presence checks, something that we are working towards in 1.6. See #2610 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello There,
I use mapstruct version 1.5.5.Final and I'm using to creating XML messages from Map<String, Object>-s.
I have a problem when mapping the message, it creates empty tags. Because I use Map for source and the MapStruct check if the Map contains the element at last level and every level it creates an empty element.
I use AfterMapping-s to remove these.
Is there a better solution for this?
Example:
Generates:
These will return "empty" XML java classes, and the XML will be like this - InstdAmt and InstdCcy is null/Map not contains them:
In this case I would like to get this:
For this result I could use AfterMapping's:
I could use a common AfterMapping, but it has a non-null value check, so it won't work, because I could't return null.
Is there way to turn of this null check or a better solution for this "problem"?
Thank You and Best Regards,
Gábor
Beta Was this translation helpful? Give feedback.
All reactions