no problem.  when you say field="_state"
you're telling jibx that your class "Address" has a field
called _state.  the name="state" part describes the
other side (the xml side) of things.  the fact that they're
on the same tag binds them to one another.

/ eitan


On Apr 11, 2005, at 7:15 PM, Paul Tomsic wrote:

Sorry for being "thick" here, but in the second
example, what is binding the structure'd State to the
mapping state?
Or is that implicitly taken care of?

--- Eitan Suez <[EMAIL PROTECTED]>
wrote:
you have two choices:

   1. you can define the mapping for all structures
in a single
     mapping, nesting in the definitions for address
and state,
   or
   2. you can define three mappings, one for each
type, and
   reference them.

example for #1: (just for address and state)

<binding>
   <mapping name="address"
class="yourpackagename.Address">
      <structure name="state" field="_state">
        <value name="code" field="_code" />
      </structure>
   </mapping>
</binding>

example for #2:

<binding>
   <mapping name="address"
class="yourpackagename.Address">
     <structure field="_state" />
   </mapping>
   <mapping name="state"
class="yourpackagename.State">
     <value name="code" field="_code" />
   </mapping>
</binding>

/ eitan

On Apr 11, 2005, at 5:57 PM, Paul Tomsic wrote:

I'm trying to set a class from an attribute, but
it's
actually two steps down...
Here's my xml:

<Person name="Paul">
  <Address @city="Philadelphia" @state="PA"/>
   ....

So my Person class contains an Address class,
which
contains a State class.   How would I set up the
Address class and the State class that is a field
on
the Address?

Here's my classes:

public class Person {
    private Address _address;
    ....


public class Address { private State _state;

public class State {
    private String _code;


What would my mapping look like to set the State
from
that attribute?

Thanks



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT
Products from real users.
Discover which products truly live up to the hype.
Start reading now.

http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
jibx-users mailing list
[email protected]

https://lists.sourceforge.net/lists/listinfo/jibx-users



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to