Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] [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

-- 
View this message in context: http://www.nabble.com/-MOXy--xml-choice-object-mapping-incompatible-with-preserve-document-option--tp18822464p18822464.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top