Hi Ken,

[email protected] wrote:
> My first post to this list, so I hope this email is OK.
> (Werner made me do it.)
Yes, I did, and I hope I didn't not ask for something completely
unnatural .. ;-).

> With respect to: 
> http://www.mail-archive.com/[email protected]/msg07192.html
> 
> The following code snippet:
> 
>             ...
>         osw = new OutputStreamWriter(output.getOutputStream(), 
> TagDBInstance.ENCODING);
>                 ...
>         Marshaller marshaller = new Marshaller(osw);
>         marshaller.setEncoding(TagDBInstance.ENCODING);
>         marshaller.setSuppressNamespaces(true);
>         marshaller.setValidation(CGateProperties.get("tag-validate-db", 
> "yes").equalsIgnoreCase("yes"));
>         marshaller.setProperty("org.exolab.castor.indent", "true");
>         marshaller.marshal(installation); // write out to the file 
> <path>.new
>         osw.close();
> 
> results in a file containing:
> 
> <?xml version="1.0" encoding="utf-8"?>
> <Installation><OID>1a4bcf00-0fb2-102c-961c-f8fc7867ab87</OID><DBVersion>2.2</DBVersion>........
> 
> ie the  marshaller.setProperty("org.exolab.castor.indent", "true"); line 
> is not working.
> 
> This is in castor 1.3.
> 
> Either there is something wrong in the code, or it is a bug.
It probably is a bug, but let's see whether there is an easy workaround.
Can you please change your code above as follows:

XMLContext context = new XMLContext(),

Marshaller marshaller = context.createMarshaller();
marshaller.setWriter(osw),
marshaller.setProperty("org.exolab.castor.indent", "true");
marshaller.setEncoding(TagDBInstance.ENCODING);
marshaller.setSuppressNamespaces(true);
marshaller.setValidation(CGateProperties.get("tag-validate-db", "yes")
   .equalsIgnoreCase("yes"));
marshaller.marshal(installation); // write out to the file

If that does not help either, try to invoke the setProperty() call on
the XMLContext instance.

I hope this helps
Regards
Werner

> If it is the code, I'd appreciate being set straight.
> 
> Unfortunately the documentation seems to be lagging behind the releases, 
Yes, it does. Mind indicating where things should be changed in your view ?

> so I'm using net searches for answers to my castor problems.
> 
> Ken Wagnitz.

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

    http://xircles.codehaus.org/manage_email


Reply via email to