Wednesday, 15 July 2015

java - JAXB + JDO marshalling produces empty XML root element -


This is my problem: I have successfully stored the contents of XML in an indestructible and RDBMS. I can recover the object from the database well. However, I can not get the marshaling part to work properly

This is my code for marshaling:

  // JAXB Marshling JXBCTXXXXXXXXXXXX Marshall Marshaller = Jacob Contantete .Creat Marshler (); Marshaller.setProperty (Marshaler. JAXB_FORMATTED_OUTPUT, true); Transactions Tx = BBC. Transaction (); Try {tx.begin (); Expansion e = pm.getExtent (type DELVRY03.class, true); Iterator Iter = E. Knitter (); While (iter.hasNext ()) {DELVRY03Type delvry03 = (DELVRY03Type) iter.next (); ObjectFactory objectFactory = New ObjectFactory (); JAXBElement & LT; DELVRY03Type & gt; J = ObjectFinor.Create DELELRY3 (Delvery3); Marshaller Marshall (J., System Out); } Tx.commit (); Println ("Read"); } Finally {if (tx.isActive ()) {tx.rollback (); } Pm.close (); }  

DELVRY03Type is my main square (XML root element). The strange thing is that if I get the internal objects (hair) of delvry03 obtained once from the database, then I can read their characteristics properly. But this is what Marshall shows in the output in XML:

   

What can be the problem? How can it be that the objects are okay and then marshaling can create an empty root element?

I have tried to do a contracted uniforming + marshaling without storing objects in the database and it does the right marshal, I am confused.

Any help would be appreciated.


No comments:

Post a Comment