Re: [jibx-users] post-set method not working..what am I doing wrong?

2004-11-12 Thread Beet
The problem is that I'm using the default attribute to set each
element value to the empty string if it doesn't exist, so nothing is
ever null.  Right now I've had to settle for doing similar to what you
suggested as your second option, but I don't really like it because,
since nothing is ever null, I use the empty string for comparison.  So
if all the subelements in my optional structure are empty, then the
boolean never gets set.

I'm just curious as to why post-set doesn't work in this instance.  Is
there a reason for this?


On Thu, 11 Nov 2004 19:59:00 -0800, Dennis Sosnoski [EMAIL PROTECTED] wrote:
 Beet wrote:
 
 
 
 I have a XML element, 'Worksheet,' which consists entirely of optional
 structures.
 
 In my java file, I have a bunch of booleans that denote the existence
 of the optional structures.  However, after marshalling, I cannot get
 JiBX to set these booleans to true if the optional element exists.
 The default constructor sets these values to false.  I tried putting
 post-set hooks on the optional elements, but they seem to be ignored.
 I assume the correct thing to do is to set a post-set on the main
 parent, 'Worksheet'.   However, I don't know how to check for the
 existence of optional sub-elements at that level.
 
 There are several ways you could handle this. One would be to use
 set-methods for the optional structures, and have the set-methods set
 the corresponding boolean as well as storing the actual object if the
 value passed in is non-null. Another would be to do basically the same
 thing in the post-set method, and look for the values that are
 associated with the optional elements. If the optional element is not
 present in the document JiBX will set a null value for the corresponding
 object.
 
 Does that help, or is there something I'm not understanding about your
 requirements?
 
   - Dennis
 
 ---
 This SF.Net email is sponsored by:
 Sybase ASE Linux Express Edition - download now for FREE
 LinuxWorld Reader's Choice Award Winner for best database on Linux.
 http://ads.osdn.com/?ad_id=5588alloc_id=12065op=click
 ___
 jibx-users mailing list
 [EMAIL PROTECTED]
 https://lists.sourceforge.net/lists/listinfo/jibx-users



---
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588alloc_id=12065op=click
___
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users


Re: [jibx-users] post-set method not working..what am I doing wrong?

2004-11-12 Thread Dennis Sosnoski
It's probably best if you can show an example of what you're trying to 
do, with the fragment of the binding definition and the actual post-set 
method code.

- Dennis
Beet wrote:
The problem is that I'm using the default attribute to set each
element value to the empty string if it doesn't exist, so nothing is
ever null.  Right now I've had to settle for doing similar to what you
suggested as your second option, but I don't really like it because,
since nothing is ever null, I use the empty string for comparison.  So
if all the subelements in my optional structure are empty, then the
boolean never gets set.
I'm just curious as to why post-set doesn't work in this instance.  Is
there a reason for this?
On Thu, 11 Nov 2004 19:59:00 -0800, Dennis Sosnoski [EMAIL PROTECTED] wrote:
 

Beet wrote:

   

I have a XML element, 'Worksheet,' which consists entirely of optional
structures.
In my java file, I have a bunch of booleans that denote the existence
of the optional structures.  However, after marshalling, I cannot get
JiBX to set these booleans to true if the optional element exists.
The default constructor sets these values to false.  I tried putting
post-set hooks on the optional elements, but they seem to be ignored.
I assume the correct thing to do is to set a post-set on the main
parent, 'Worksheet'.   However, I don't know how to check for the
existence of optional sub-elements at that level.
 

There are several ways you could handle this. One would be to use
set-methods for the optional structures, and have the set-methods set
the corresponding boolean as well as storing the actual object if the
value passed in is non-null. Another would be to do basically the same
thing in the post-set method, and look for the values that are
associated with the optional elements. If the optional element is not
present in the document JiBX will set a null value for the corresponding
object.
Does that help, or is there something I'm not understanding about your
requirements?
 - Dennis

---
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588alloc_id=12065op=click
___
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users


Re: [jibx-users] post-set method not working..what am I doing wrong?

2004-11-12 Thread Beet
Here's the fragment from the mapping file:

...
structure name=Batch usage=optional test-method=hasBatch
post-set=postset
value name=TS style=attribute field=ts/
value name=MaxKG field=maxKGPerBatch/
/structure
...

it doesn't matter what I put into postset because it doesn't ever
get called.  I've run a debugger and it never stops in that method.



On Fri, 12 Nov 2004 10:58:50 -0800, Dennis Sosnoski [EMAIL PROTECTED] wrote:
 It's probably best if you can show an example of what you're trying to
 do, with the fragment of the binding definition and the actual post-set
 method code.
 
 - Dennis
 
 
 
 Beet wrote:
 
 The problem is that I'm using the default attribute to set each
 element value to the empty string if it doesn't exist, so nothing is
 ever null.  Right now I've had to settle for doing similar to what you
 suggested as your second option, but I don't really like it because,
 since nothing is ever null, I use the empty string for comparison.  So
 if all the subelements in my optional structure are empty, then the
 boolean never gets set.
 
 I'm just curious as to why post-set doesn't work in this instance.  Is
 there a reason for this?
 
 
 On Thu, 11 Nov 2004 19:59:00 -0800, Dennis Sosnoski [EMAIL PROTECTED] 
 wrote:
 
 
 Beet wrote:
 
 
 
 
 
 I have a XML element, 'Worksheet,' which consists entirely of optional
 structures.
 
 In my java file, I have a bunch of booleans that denote the existence
 of the optional structures.  However, after marshalling, I cannot get
 JiBX to set these booleans to true if the optional element exists.
 The default constructor sets these values to false.  I tried putting
 post-set hooks on the optional elements, but they seem to be ignored.
 I assume the correct thing to do is to set a post-set on the main
 parent, 'Worksheet'.   However, I don't know how to check for the
 existence of optional sub-elements at that level.
 
 
 
 There are several ways you could handle this. One would be to use
 set-methods for the optional structures, and have the set-methods set
 the corresponding boolean as well as storing the actual object if the
 value passed in is non-null. Another would be to do basically the same
 thing in the post-set method, and look for the values that are
 associated with the optional elements. If the optional element is not
 present in the document JiBX will set a null value for the corresponding
 object.
 
 Does that help, or is there something I'm not understanding about your
 requirements?
 
   - Dennis
 
 
 ---
 This SF.Net email is sponsored by:
 Sybase ASE Linux Express Edition - download now for FREE
 LinuxWorld Reader's Choice Award Winner for best database on Linux.
 http://ads.osdn.com/?ad_id=5588alloc_id=12065op=click
 ___
 jibx-users mailing list
 [EMAIL PROTECTED]
 https://lists.sourceforge.net/lists/listinfo/jibx-users



---
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588alloc_id=12065op=click
___
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users


Re: [jibx-users] post-set method not working..what am I doing wrong?

2004-11-12 Thread Dennis Sosnoski
Okay, that makes it clear. The post-set method (along with factory, 
pre-set, and pre-get) only get used when there's an object associated 
with the structure. In this case you don't have an actual object, just 
some contained fields. If you go up a level (or more) to where you have 
the definition of your actual object (generally either as a mapping 
element or a contained structure that references a field of the 
containing object) you can use the post-set method there.

It should really be an error to specify post-set on a structure that 
doesn't define an object. I'll add a check for this in the beta 4 code, 
which has much better error checking and handling in general.

 - Dennis
Beet wrote:
Here's the fragment from the mapping file:
...
structure name=Batch usage=optional test-method=hasBatch
post-set=postset
value name=TS style=attribute field=ts/
value name=MaxKG field=maxKGPerBatch/
/structure
...
it doesn't matter what I put into postset because it doesn't ever
get called.  I've run a debugger and it never stops in that method.

On Fri, 12 Nov 2004 10:58:50 -0800, Dennis Sosnoski [EMAIL PROTECTED] wrote:
 

It's probably best if you can show an example of what you're trying to
do, with the fragment of the binding definition and the actual post-set
method code.
- Dennis

Beet wrote:
   

The problem is that I'm using the default attribute to set each
element value to the empty string if it doesn't exist, so nothing is
ever null.  Right now I've had to settle for doing similar to what you
suggested as your second option, but I don't really like it because,
since nothing is ever null, I use the empty string for comparison.  So
if all the subelements in my optional structure are empty, then the
boolean never gets set.
I'm just curious as to why post-set doesn't work in this instance.  Is
there a reason for this?
On Thu, 11 Nov 2004 19:59:00 -0800, Dennis Sosnoski [EMAIL PROTECTED] 
wrote:
 

Beet wrote:


   

I have a XML element, 'Worksheet,' which consists entirely of optional
structures.
In my java file, I have a bunch of booleans that denote the existence
of the optional structures.  However, after marshalling, I cannot get
JiBX to set these booleans to true if the optional element exists.
The default constructor sets these values to false.  I tried putting
post-set hooks on the optional elements, but they seem to be ignored.
I assume the correct thing to do is to set a post-set on the main
parent, 'Worksheet'.   However, I don't know how to check for the
existence of optional sub-elements at that level.

 

There are several ways you could handle this. One would be to use
set-methods for the optional structures, and have the set-methods set
the corresponding boolean as well as storing the actual object if the
value passed in is non-null. Another would be to do basically the same
thing in the post-set method, and look for the values that are
associated with the optional elements. If the optional element is not
present in the document JiBX will set a null value for the corresponding
object.
Does that help, or is there something I'm not understanding about your
requirements?
- Dennis

---
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588alloc_id=12065op=click
___
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users


Re: [jibx-users] post-set method not working..what am I doing wrong?

2004-11-12 Thread Beet
okay, I see what you're saying...

the problem with going up a level is that you lose the level of
granularity you sometimes need.  I know that you listed some
workarounds before, and that's what I'm using right now, but it seems
like it'd be a nice little 'enhancement' to allow method hooks at this
level.

Or is it just not possible?  I admit I haven't seen the source code,
so maybe I'm just not getting something.

On Fri, 12 Nov 2004 11:45:43 -0800, Dennis Sosnoski [EMAIL PROTECTED] wrote:
 Okay, that makes it clear. The post-set method (along with factory,
 pre-set, and pre-get) only get used when there's an object associated
 with the structure. In this case you don't have an actual object, just
 some contained fields. If you go up a level (or more) to where you have
 the definition of your actual object (generally either as a mapping
 element or a contained structure that references a field of the
 containing object) you can use the post-set method there.
 
 It should really be an error to specify post-set on a structure that
 doesn't define an object. I'll add a check for this in the beta 4 code,
 which has much better error checking and handling in general.
 
   - Dennis
 
 
 
 Beet wrote:
 
 Here's the fragment from the mapping file:
 
 ...
 structure name=Batch usage=optional test-method=hasBatch
 post-set=postset
value name=TS style=attribute field=ts/
value name=MaxKG field=maxKGPerBatch/
 /structure
 ...
 
 it doesn't matter what I put into postset because it doesn't ever
 get called.  I've run a debugger and it never stops in that method.
 
 
 
 On Fri, 12 Nov 2004 10:58:50 -0800, Dennis Sosnoski [EMAIL PROTECTED] 
 wrote:
 
 
 It's probably best if you can show an example of what you're trying to
 do, with the fragment of the binding definition and the actual post-set
 method code.
 
 - Dennis
 
 
 
 Beet wrote:
 
 
 
 The problem is that I'm using the default attribute to set each
 element value to the empty string if it doesn't exist, so nothing is
 ever null.  Right now I've had to settle for doing similar to what you
 suggested as your second option, but I don't really like it because,
 since nothing is ever null, I use the empty string for comparison.  So
 if all the subelements in my optional structure are empty, then the
 boolean never gets set.
 
 I'm just curious as to why post-set doesn't work in this instance.  Is
 there a reason for this?
 
 
 On Thu, 11 Nov 2004 19:59:00 -0800, Dennis Sosnoski [EMAIL PROTECTED] 
 wrote:
 
 
 
 
 Beet wrote:
 
 
 
 
 
 
 
 I have a XML element, 'Worksheet,' which consists entirely of optional
 structures.
 
 In my java file, I have a bunch of booleans that denote the existence
 of the optional structures.  However, after marshalling, I cannot get
 JiBX to set these booleans to true if the optional element exists.
 The default constructor sets these values to false.  I tried putting
 post-set hooks on the optional elements, but they seem to be ignored.
 I assume the correct thing to do is to set a post-set on the main
 parent, 'Worksheet'.   However, I don't know how to check for the
 existence of optional sub-elements at that level.
 
 
 
 
 
 There are several ways you could handle this. One would be to use
 set-methods for the optional structures, and have the set-methods set
 the corresponding boolean as well as storing the actual object if the
 value passed in is non-null. Another would be to do basically the same
 thing in the post-set method, and look for the values that are
 associated with the optional elements. If the optional element is not
 present in the document JiBX will set a null value for the corresponding
 object.
 
 Does that help, or is there something I'm not understanding about your
 requirements?
 
  - Dennis
 
 
 ---
 This SF.Net email is sponsored by:
 Sybase ASE Linux Express Edition - download now for FREE
 LinuxWorld Reader's Choice Award Winner for best database on Linux.
 http://ads.osdn.com/?ad_id=5588alloc_id=12065op=click
 ___
 jibx-users mailing list
 [EMAIL PROTECTED]
 https://lists.sourceforge.net/lists/listinfo/jibx-users



---
This SF.Net email is sponsored by: InterSystems CACHE
FREE OODBMS DOWNLOAD - A multidimensional database that combines
robust object and relational technologies, making it a perfect match
for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8
___
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users