P
Peter Plumber
Hi,
I am a very beginner with programming java.
I am trying to use java.beans.XMLEncoder for creating a String
containing the XML serialization of my object.
I am using the following code (probably clumsy code)
/**
* serialize object to XML as String.
*/
public String serialize(){
ByteArrayOutputStream streamOut = new ByteArrayOutputStream();
XMLEncoder xmlCreater = new XMLEncoder(streamOut);
xmlCreater.writeObject(this);
xmlCreater.close();
return streamOut.toString();
}
my problem is that in the result some characters are changed
e.g.: "PhÃ?nomene" instead of "Phänomene"
how could I solve this problem?
is there a less lengthy way to get the bean XML?
thanks
Peter
I am a very beginner with programming java.
I am trying to use java.beans.XMLEncoder for creating a String
containing the XML serialization of my object.
I am using the following code (probably clumsy code)
/**
* serialize object to XML as String.
*/
public String serialize(){
ByteArrayOutputStream streamOut = new ByteArrayOutputStream();
XMLEncoder xmlCreater = new XMLEncoder(streamOut);
xmlCreater.writeObject(this);
xmlCreater.close();
return streamOut.toString();
}
my problem is that in the result some characters are changed
e.g.: "PhÃ?nomene" instead of "Phänomene"
how could I solve this problem?
is there a less lengthy way to get the bean XML?
thanks
Peter