I wanted to serialize a java class to XML with XStream.
I needed to generated an XML element with one underline (canal_operateur), but XStream adds a second underline in the xml element name.
So how to keep only one underline ?
With the default configuration for this class :
public class Document implements Serializable {
private String typedoc;
private Fichier fichier;
private String canalOperateur;
//xstream.aliasField("canal_operateur", Document.class, "canalOperateur");
/*
** setter and getter
*/
}
XStream doubles the underline :
<document>
<canal__operateur>canal</canal__operateur>
<commentaire>commentaire</commentaire>
<metadonnees/>
</document>