Werner, Thanks for your interest. I'd fixed my problem, and it ends up being the same amount of code either way. The only reason I posted was because when I googled the problem I saw that other people had run into it, and I couldn't find any posted solution.
Re John Shott's problem of today: I did the same thing, the first time I needed to a castor.properties file. It comes from having low expectations of (any) documentation, and just looking at the code and emulating what I/we think I/we see. So I didn't even bother to look at the docs - just saw where the file apparently (and incorrectly) belongs, and doing the same. -Ed -----Original Message----- From: Werner Guttmann [mailto:[email protected]] Sent: Thursday, February 04, 2010 4:03 PM To: [email protected] Cc: Lukas Lang Subject: Re: [castor-user] How to set org.exolab.castor.indent, et al, on a single Marshaller. 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 --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

