I use castor generated source code to marsh object XmlEmployees, I want to change
the default encoding to "GBK", so i changed the generated code in class XmlEmployees:
/**
*
*
* @param out
**/
public void marshal(java.io.Writer out)
throws org.exolab.castor.xml.MarshalException,
org.exolab.castor.xml.ValidationException
{
Marshaller.marshal(this, out);
} //-- void marshal(java.io.Writer)
to
public void marshal(java.io.Writer out)
throws org.exolab.castor.xml.MarshalException,
org.exolab.castor.xml.ValidationException
{
try {
Marshaller msa = new Marshaller(out);
msa.setEncoding("GBK");
msa.marshal(this, out);
}
catch (IOException ex) {
}
} //-- void marshal(java.io.Writer)
and in my test code
java.io.FileOutputStream fileOut=new java.io.FileOutputStream("test.xml");
java.io.OutputStreamWriter out=new java.io.OutputStreamWriter(fileOut,"GBK");
xmlEmployees.marshal(out);
but the output file test.xml encoding is still
<?xml version="1.0" encoding="UTF-8"?>
[EMAIL PROTECTED]
2004-02-28
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev