users@jaxb.java.net

RE: Updating an XML FIle

From: Robert Lowe <rmlowe_at_rmlowe.com>
Date: Wed, 27 Aug 2003 04:56:52 +0800

> The problem is that if I unmarshal the original XML file created by
SystemA, then I cannot just call the set methods to populate SystemB data as
I get a null exception. One alternative is for SystemB and SystemC to
regenerate the whole file using ObjectFactory - easy in this example but
much more difficult in a real example.

You should be doing something like:

Root root = unmarshaller.unmarshal(...);
SystemB systemB1 = ObjectFactory.createSystemB("data for system B here");
root.setSystemB(systemB1);

and not:

Root root = unmarshaller.unmarshal(...);
root.getSystemB().setValue("data for system B here");

Right?

- Rob


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net