Use of Mapstruct with JAXB atom+xml data feeds

227 views
Skip to first unread message

Donald F. Coffin

unread,
Mar 12, 2018, 10:45:26 AM3/12/18
to mapstruct-users
I am attempting to use Mapstruct with Spring Boot 2.0 for an application that processes atom+xml data feeds.  The challenge I am encountering is determining how Mapstruct interacts with JAXBElement to marshal and unmarshal the atom+xml datastream.  I've looked for examples within the existing documentation, but am not able to find what I need.  This may simply be due to a lack of experience.

Do I need to create JAXBElement marshalling adapters or does Mapstruct connect to the JAXB generated ObjectFactory specific _QNAME entry?  

Any assistance or examples would be helpful.

Donald F. Coffin

Filip Hrisafov

unread,
Mar 17, 2018, 9:35:15 AM3/17/18
to mapstruct-users
Hey Donald,

I am not that familiar with JAXB. However, when looking into Mapping method resolution there is na note about JAXB saying:

When working with JAXB, e.g. when converting a String to a corresponding JAXBElement<String>, MapStruct will take the scope and name attributes of @XmlElementDecl annotations into account when looking for a mapping method. This makes sure that the created JAXBElement instances will have the right QNAME value. You can find a test which maps JAXB objects here.

Have a look at the linked test, it might help you out.

Cheers,
Filip

Donald F. Coffin

unread,
Mar 17, 2018, 7:24:39 PM3/17/18
to mapstruct-users
Filip,

Thanks for the response, but I am receiving a 404 -- Not Found when I click on the link in the documentation.

Filip Hrisafov

unread,
Mar 18, 2018, 6:15:37 AM3/18/18
to mapstruct-users
Oops, we need to fix the link :). Here is the correct link

Donald F. Coffin

unread,
Mar 18, 2018, 8:06:12 PM3/18/18
to mapstruct-users
Thanks.  This will help a lot.
Reply all
Reply to author
Forward
0 new messages