Hi Edward,

just wondering whether Lukas' advice enabled you o get past your problem ?

Cheers
Werner

On 24.01.2010 14:33, Lukas Lang wrote:
Hello Ed,

indeed, this sounds not very intuitive to me either. From what I've learned, I 
can recommend using the XMLContext as explained in [1] instead of instantiating 
Marshaller and Unmarshaller manually. It was introduced to configure your 
environment in a global manner so that it will be available to both Marshaller 
and Unmarshaller (see [2]), (hopefully) independent of the order of 
configuration.

Let us know, in case you experience the same behavior using XMLContext for 
bootstrapping Castor!

Regards,
Lukas

[1] XMLContext - A consolidated way to bootstrap Castor, 
http://www.castor.org/1.3/reference/html-single/index.html#d0e259
[2] Accessing the properties from within code, 
http://www.castor.org/1.3/reference/html-single/index.html#d0e2265


Am 23.01.2010 um 20:19 schrieb Staub, Edward:

I wasn’t able to find any help in the lists or anywhere else on this, and had 
to debug into Castor to figure it out.  I’m writing this for posterity.  It may 
belong in the faqs, or it might be a bug – other folks can judge this.

The following code WON’T work:

             Marshaller m = new Marshaller(writer);
             m.setProperty("org.exolab.castor.indent", "true");
             m.marshal(sysCfg);

The reason is that the properties are interpreted when the output Writer is set 
– in this case, in the constructor.
Instead, set the Writer AFTER setting the property, like so:

             Marshaller m = new Marshaller();
             m.setProperty("org.exolab.castor.indent", "true");
             m.setWriter(writer);
             m.marshal(sysCfg);

-Ed Staub


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

     http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to