Hello,

any idea to solve this problem?

I've got unnamed abstract mappings extended by other mappings, and I need to 
make this structure flexible. What would be a good way to do this?

See my first message below for more details and an example.

Thanks in advance if anyone can help

Romain

________________________________
De : CONSORT NT - LARVET, Roman
Envoyé : mercredi 8 octobre 2008 10:36
À : 'jibx-users@lists.sourceforge.net'
Objet : Flexible="true" and unnamed abstract mapping

Hello,

As described in the title, I need help to solve a problem with a binding using 
unnamed abstract mappings like this one:

########################################
Binding:
########################################

<?xml version="1.0" encoding="ISO-8859-1"?>
<binding track-source="true">

 <mapping name="Menagerie" class="menagerie.Menagerie"
   ordered="false" flexible="true">
  <collection name="Dogs" field="dogs"
   item-type="animal.Dog" type="menagerie.PetList"
   factory="menagerie.Menagerie.createPetList"
   add-method="addPet"/>
  <collection name="Fishes" field="fishes"
   item-type="animal.Fish" type="menagerie.PetList"
   factory="menagerie.Menagerie.createPetList"
   add-method="addPet"/>
 </mapping>

 <mapping abstract="true" class="animal.Pet"
   ordered="false" flexible="true">
  <value name="Name" field="name" />
 </mapping>

 <mapping name="Dog" class="animal.Dog" extends="animal.Pet"
   ordered="false" flexible="true">
  <structure map-as="animal.Pet" ordered="false" flexible="true"/>
  <value name="Pedigree" field="pedigree"/>
 </mapping>

 <mapping name="Fish" class="animal.Fish" extends="animal.Pet"
   ordered="false" flexible="true">
  <structure map-as="animal.Pet" ordered="false" flexible="true"/>
  <value name="Color" field="color"/>
 </mapping>

</binding>


########################################
Errors when compiling the binding:
########################################

Error: All child components must define element names for flexible='true'; on st
ructure element at (line 27, col 67, in flexible-pet-binding.xml)
Error: All child components must define element names for flexible='true'; on st
ructure element at (line 32, col 67, in flexible-pet-binding.xml)


########################################
Sample XML Source Document
########################################

<?xml version="1.0" encoding="ISO-8859-1"?>
<Menagerie>
 <Dogs>
  <Dog>
   <Name>Max</Name>
   <Pedigree>German Shepherd</Pedigree>
  </Dog>
 </Dogs>
 <Fishes>
  <Fish>
   <Name>Blub</Name>
   <Color>Red</Color>
  </Fish>
 </Fishes>
</Menagerie>


This is a sample binding to isolate the problem, my real binding is much bigger.
In the real abstract mother class I've got many fields, as well as in the child 
classes, and there are many child classes.
I need to make this mapping totally flexible in order to ignore any additionnal 
elements anywhere in the XML source document.

My question is: what would be the best way to make this structure totally 
flexible, with the least possible impact on my Java classes?
If this is important for the answer, I use JiBX only for unmarshalling the XML 
source document, there's no marshalling in my application.

Thanks in advance for your answers,
Romain LARVET


________________________________
L'integrité de ce message n'étant pas assurée sur internet, Bouygues Telecom ne 
peut être tenue responsable de son contenu en ce compris les pièces jointes. 
Toute utilisation ou diffusion non autorisée est interdite. Si vous n'êtes pas 
destinataire de ce message, merci de le détruire et d'avertir l'expéditeur.

The integrity of this message cannot be guaranteed on the Internet. Bouygues 
Telecom can not therefore be considered liable for the contents including its 
attachments. Any unauthorized use or dissemination is prohibited. If you are 
not the intended recipient of this message, then please delete it and notify 
the sender.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to