Hi Paul,
Can you do a
System.out.println(contact.xmlText());
in each of the scenarios below?
How is Address defined in the schema?
Thanks,
-jacobd

On Jan 11, 2008 9:29 AM, Paul French <[EMAIL PROTECTED]> wrote:

>  Hello,
>
> I have created a library using scomp from an xml schema.
>
> I am building a XML document using this library. I have come across some
> behaviour I do not understand. For this example a BusinessDescription may
> have a Contact and a Contact may have an Address.
>
>
> If I do the following:
>
> BusinessDescription.Contact contact = businessDescription.addNewContact();
> contact.setAddress(address);
>
> if (businessDescription.getContact().getAddress() != null)
> {
>     System.out.println("Address is not null");
> }
> else
> {
>      System.out.println("Address is null");
> }
>
> My code prints out "Address is not null" as expected
>
>
> However If I do the following:
>
> BusinessDescription.Contact contact =
> BusinessDescription.Contact.Factory.newInstance();
> businessDescription.setContact(contact);
> contact.setAddress(address);
>
>  if (businessDescription.getContact().getAddress() != null)
> {
>     System.out.println("Address is not null");
> }
> else
> {
>     System.out.println("Address is null");
> }
>
> My code prints out "Address is null".
>
> For some reason setting the address on the contact object after the
> contact object is set on the businessDescription is ignored. XMLBeans must
> be cloning objects internally?? This behaviour is unintuitive to me? Can
> someone explain.
>
> Thanks
>



-- 
I'm competing in a Half-Ironman distance triathlon to raise money for the
fight against cancer!
Please help support my efforts by going to:
http://www.active.com/donate/tntwaak/jacobd

Reply via email to