|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
[MOXy] xml choice object mapping incompatible with preserve document option?Hi,
I am trying to use XML Choice Mapping to map a hierarchy of objects. I find that when I turn on the "preserve document" option, this mapping fails. As soon as I turn off the "preserve document" option, this mapping works fine. Is this a bug or are they incompatible for some reason? Or is it because of the XML Any Collection Mapping that is also under the same element that is conflicting? Here is my XML for configuring the choice mapping. Please let me know if it's wrong, because the workbench does not generate this kind of mapping, so I figured out the format by browsing the source code and hacking the mapping until it worked. <attribute-mapping xsi:type="xml-choice-object-mapping"> <attribute-name>action</attribute-name> <field-to-class-association> <xml-field name="DataArea/A" xsi:type="node" /> <class-name>com.foo.A</class-name> </field-to-class-association> <field-to-class-association> <xml-field name="DataArea/B" xsi:type="node" /> <class-name>com.foo.B</class-name> </field-to-class-association> <field-to-class-association> <xml-field name="DataArea/C" xsi:type="node" /> <class-name>com.foo.C</class-name> </field-to-class-association> ... </attribute-mapping> Here's the any collection: <attribute-mapping xsi:type="xml-any-collection-mapping"> <attribute-name>stuff</attribute-name> <field name="DataArea/" xsi:type="node"/> <container xsi:type="list-container-policy"> <collection-type>java.util.Vector</collection-type> </container> <keep-as-element-policy>KEEP_NONE_AS_ELEMENT</keep-as-element-policy> </attribute-mapping> </attribute-mappings> ... <should-preserve-document>true</should-preserve-document> Any insight would be greatly appreciated! Thanks, Polly |
|
|
Re: [MOXy] xml choice object mapping incompatible with preserve document option?Hi Polly,
This is a known issue with the choice mappings. Currently the document preservation functionality is dependent (at least for marshalling) on the DOMPlatform, and the choice mappings aren't currently supported with the DOM platform. There's a bug tracking this issue already which you can view here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=223907 -Matt amphoras wrote: >Hi, > >I am trying to use XML Choice Mapping to map a hierarchy of objects. I find >that when I turn on the "preserve document" option, this mapping fails. As >soon as I turn off the "preserve document" option, this mapping works fine. >Is this a bug or are they incompatible for some reason? Or is it because of >the XML Any Collection Mapping that is also under the same element that is >conflicting? > >Here is my XML for configuring the choice mapping. Please let me know if >it's wrong, because the workbench does not generate this kind of mapping, so >I figured out the format by browsing the source code and hacking the mapping >until it worked. > > <attribute-mapping xsi:type="xml-choice-object-mapping"> > <attribute-name>action</attribute-name> > <field-to-class-association> > <xml-field name="DataArea/A" xsi:type="node" /> > <class-name>com.foo.A</class-name> > </field-to-class-association> > <field-to-class-association> > <xml-field name="DataArea/B" xsi:type="node" /> > <class-name>com.foo.B</class-name> > </field-to-class-association> > <field-to-class-association> > <xml-field name="DataArea/C" xsi:type="node" /> > <class-name>com.foo.C</class-name> > </field-to-class-association> > ... > </attribute-mapping> > >Here's the any collection: > <attribute-mapping xsi:type="xml-any-collection-mapping"> > <attribute-name>stuff</attribute-name> > <field name="DataArea/" xsi:type="node"/> > <container xsi:type="list-container-policy"> > <collection-type>java.util.Vector</collection-type> > </container> > ><keep-as-element-policy>KEEP_NONE_AS_ELEMENT</keep-as-element-policy> > </attribute-mapping> > </attribute-mappings> > ... > <should-preserve-document>true</should-preserve-document> > >Any insight would be greatly appreciated! > >Thanks, >Polly > > > eclipselink-users mailing list eclipselink-users@... https://dev.eclipse.org/mailman/listinfo/eclipselink-users |
|
|
Re: [MOXy] xml choice object mapping incompatible with preserve document option?Hi Matt,
Ah, ok. So I am not crazy. :) Thanks! --Polly
|
| Free embeddable forum powered by Nabble | Forum Help |