Created
April 12, 2013 10:11
-
-
Save simonharrer/5371022 to your computer and use it in GitHub Desktop.
Simple example for JAXB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.xml.bind.JAXB; | |
import javax.xml.bind.JAXBException; | |
public class Person { | |
private String name; | |
private int age; | |
public String getName() { | |
return name; | |
} | |
public void setName(String name) { | |
this.name = name; | |
} | |
public int getAge() { | |
return age; | |
} | |
public void setAge(int age) { | |
this.age = age; | |
} | |
public static void main(String[] args) throws JAXBException { | |
Person person = new Person(); | |
person.setName("Max Mustermann"); | |
person.setAge(39); | |
JAXB.marshal(person, System.out); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment