Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Moxy map attribute that doesn't exist in the object model.

I want this:

<env:Code>
    <env:Value xml:lang="sv_SE"></env:Value>
<env:Code>

I need to be able to both marshal and unmarshal.

I have no interest in xml:lang in my objects, but I need to get it into the xml.

Right now I have this:

XMLTransformationMapping faultCodeLang = new XMLTransformationMapping();
faultCodeLang.setAttributeName("lang");
faultCodeLang.addFieldTransformer("env:Code/env:Value/@xml:lang", new DefaultLocaleTransformer());
faultCodeLang.setAttributeTransformer(new AttributeTransformerAdapter() {
    //
});
fault.addMapping(faultCodeLang);

It does work, but now I need to have a lang attribute on my object. 

Is there a better way to do this?

--

 /Magnus Heino

Back to the top