After looking through the documents and testing JIBX for a proof of
concept application we are developing we've come across a roadblock we
can't seem to cross. Hopefully I can illustrate the exact nature of this
problem.

Our problem deals with wanting objects to be rendered into XML using a
number of different formats. To illustrate this see the example let's
assume we are creating a system which has two classes:

public class Example {
  private int id;
  private String name;
  private String sensitiveData;
}

public class MailingListPost {
  private String to;
  private Example example;
}

As shown above I have two objects. Both objects at some point in the
system need to be rendered as XML. The problem lies with the fact that
the class 'Example' has two different formats, or views, that can be
determined at runtime based on other internal data (such as the role of
the user who wishes to view Example), for example let's assume the two
structures are:

<Example>
  <id>1</id>
  <name>Chris</name>
</Example>

<Example>
  <id>1</id>
  <name>Chris</name>
  <sensitiveData>it's a secret</sensitiveData>
</Example>

So now I have a situation where by example may be rendered two different
ways either directly by passing an Example object to the marshaller, or
indirectly by passing a MailingListPost to the marshaller.

I know the second scenario (rendering it two different ways indirectly)
can be addressed by defining a <mapping> with a type-name and
abstract=true in the Example mapping, and a <structure> with 'map-as' in
the MailingListPost, but it's unclear how I can then use the same
process of rendering Example these two different ways directly.

Furthermore it appears that this type of functionality (multiple
'versions' of a class) is addressed to some extent in example22 of the
distribution, but when I run ant example22 I receive an error which
reads:

run-example22:
     [java] org.jibx.runtime.JiBXException: Binding binding0 not found
for class example22.Customer
     [java]     at org.jibx.runtime.BindingDirectory.getFactory(Unknown
Source)
     [java]     at
example22.BindingSelector.unmarshalVersioned(BindingSelector.java:177)
     [java]     at example22.Test.main(Test.java:61)

If anyone could provide any insight into this situation based on what
I've described above we would be very grateful. The ease of use of JIBX
plus its performance is very attractive to our team so if we could
figure out a way to accomplish this multiple "views" of data idea we
would be extremely happy.

- - - - - - - - - - - - -
Chris Shorrock ([EMAIL PROTECTED])
Software Engineer
Electronic Arts Canada


-------------------------------------------------------------------------
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
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to