Hmmm, I cannot reproduce what I thought was success. I am reporting so another does not think (on the basis of my previous email) it works for me and if it is not working for them then it must be them.

I cannot get two bindings defined on the same class with each available at runtime.

I can confirm the following:

If I run the ant bind task twice,
with the xml in the binding attribute pointing to the same java class each time, then the last of the two definitions survives - the first is not found at runtime.

If I run the ant task once,
with the the xml in the binding attribute containing two binding elements,
 then the first is found at runtime, the second is not.

If I run the ant bind task once,
with the xml in the binding attribute only including two other binding files,
 then the ant task dies with a
 [bind] java.lang.NullPointerException
[bind] at org.jibx.binding.model.NameAttributes.equals(NameAttributes.java:184)

I thought I tested this - late night testing seems not to be what it appeared to be.

(Even now, after several daylight hours of twisting and turning I am no longer sure of even the above.)

Maybe it is that dratted Grinch pilfering gifts.

I will report any discoveries (including convicting the usual suspects (me.))

Bill

Günther Wieser wrote:
hi bill,

good to hear that you solved your issues!

regarding the track-source feature: this can be left out if you don't need the functionality, see the first chapter in
http://jibx.sourceforge.net/tutorial/binding-advanced.html

br,
günther

Am 20.11.2007 um 06:05 schrieb William Surowiec:

Gunther,

Thank you, it is now working using the second method you indicated. It was not obvious to me that I could have multiple bindings in one file. So, my binding.xml file is structured something like:

<binding name="bindingReportInput" direction="input" track-source="true">
    <mapping name="report"  class="xxx.Report">
    <BIG SNIP/>
    </mapping>
</binding>
<binding name="bindingReportOutput1" direction="output" track-source="true">
    <mapping name="report" class="xxx.Report">
    <BIG SNIP/>
    </mapping>
</binding>

I am not sure if the track-source has any meaning for the output direction, but nothing complained when simple cut and paste left it unintentionally in there. I will remove it (and choose better names for things as we get more serious.)

Really nice. Great tool.

Thank you again for the help (the "other" ingredient making for a great tool),

Bill

Günther Wieser wrote:
hi bill,

there are two ways to accomplish that:
first, if your input and output binding will be the same in each situation, you can use different mappings by specifying the direction="output" or direction="input" attribute in the binding element, see
http://jibx.sourceforge.net/tutorial/binding-advanced.html

second, you can use named bindings. you can specify a name in the binding element, and in your java code, you can specify which named binding you want to use. this allows you to use as many different bindings as you like or need. see the binding definition at http://jibx.sourceforge.net/details/binding-element.html for more details on the attribute "name". i think there is also some more detailed explanation in the tutorial, but i couldn't find it now.

br,
günther

Am 19.11.2007 um 22:16 schrieb William Surowiec:

Hi,

I've recently started using JibX - really useful, thank you.

But, of course, I have a question. I sense there may be several ways to accomplish what I wish to do and I would appreciate guidance on the "best practice" way. Here is what I would like to accomplish:

I have a complex, custom Java object. I receive an xml representation of it (actually a subset of it.) I can parse the subset without a problem. I now wish to produce another xml representation of it (same object) but publishing different facets of it. Structurally the resultant xml would look different than the input xml: meta data inserted, aggregation performed, some field elided.

In this specific situation, it makes sense to maintain a single object with multiple views. Is there a "best practice" jibx approach?

Thanks,

Bill



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users



--
Günther Wieser
creative-it
Guglgasse 6/1/11/1
A-1110 Wien
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
http://www.creative-it.com



------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
------------------------------------------------------------------------

_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users



--
Günther Wieser
creative-it
Guglgasse 6/1/11/1
A-1110 Wien
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
http://www.creative-it.com



------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
------------------------------------------------------------------------

_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to