1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| package Theme
import javax.xml.bind.*;
import java.io.*;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import java.util.*;
public class Unmarshalling {
public static void main(String[] args) {
try {
JAXBContext context;
context = JAXBContext.newInstance("Theme");
Unmarshaller unmarshaller;
unmarshaller = context.createUnmarshaller();
REGLE Regle ;
Regle = (REGLE) unmarshaller.unmarshal(new File("Untitled2.xml"));
System.out.println("ECA ");
System.out.println("Nom : " + Regle.getNomRegle());
System.out.println("Prenom : " + Regle.getCouplage());
System.out.println("Numero : " + Regle.getAct());
System.out.println("E-mail : " + Regle.getCond());
System.out.println("E-mail : " + Regle.getEvents());
System.out.println();
}
catch (Exception e) {
e.printStackTrace();
}
}
} |