java - JAXB - change property name without changing variable name in class -


so have code this:

@xmlrootelement(name = "person") @xmltype(proporder = {"name", "secondname"}) public class person {    private string name;    private string secondname;     public void setname(string name) {       this.name = name;    }     public string getname() {       return name;    }     public void setsecondname(string secondname) {       this.secondname = secondname;    }     public string getsecondname() {       return secondname;    } } 

and when want create xml file makes me:

<person>    <name>john</name>    <secondname>smith</secondname> </person> 

is way make in xml file <second-name> instead of <secondname> without changing in class on private string second-name?

problem solved. should this:

@xmlelement(name="second-name") public string getsecondname() {    return secondname; } 

Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -