Hello,

on the JiBX project homepage, under "Getting Started" -> "Binding Tutorial" -> 
"Custom code" -> "Controlling JiBX with front-end code", you can find an 
explanation of how to select the appropriate binding for an XML structure using 
the same element name for different bindings, e.g. by using a "type" attribute:

See http://jibx.sourceforge.net/tutorial/binding-custom.html#frontend

This works fine if the type attribute appears in the root element of the 
binding: To unmarshall an XML like that, you can (in Java) first look-up the 
appropriate binding version, then create the unmarshaller for the associated 
binding and finally start the unmarshalling.

But the situation for me is that there is a XML structure using this kind of 
attribute-based distinction in various sub-structures, like:

<item>
  <properties>
    ...
  </properties>
  <data>
    ...
    <metadata type="foo">
      ...
    </metadata>
  </data>
  <metadata type="bar">
    ...
  </metadata>
</item>

Depending on whether the "type" attribute contains the value "foo" or "bar", 
the corresponding "metadata" structure shall be bound to completely different 
Java classes. As the type attributes appear in nested structures, it seems to 
me that the binding look-up cannot be done BEFORE the unmarshalling begins, but 
instead must somehow be done DURING unmarshalling.

Is there a straightforward approach to get this going? 

Thanks for you help,

Johannes Müller

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to