JAXB 解组 returns 空

JAXB unmarshelling returns null

我正在尝试解组一个我编组的 XML 文件,但是当我打印它时它 returns 为空。

XML 文件:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<presentieLijst>
<les>
    <begintijd>15:30</begintijd>
    <docent>John Smeets</docent>
    <eindtijd>18:00</eindtijd>
    <lesDatum>2016-02-02</lesDatum>
    <lesNaam>TCIF-V1AUI-15</lesNaam>
    <lokaal>D02.08</lokaal>
</les>
</presentieLijst>

XML 包装器:

@XmlRootElement(name = "presentieLijst")
public class PresentieLijstWrapper {
private Les les;

@XmlElement(name = "les") 
public Les getLes() {
    return les;
}

public void setles(Les lessen) {
    this.les = lessen;
}
}

作为ObservableList被插入PresentieLijstWrapper.set的"Les"class:

package presentie.model;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

public class Les {
private final StringProperty lesNaam,
                             lokaal,
                             docent,
                             eindtijd,
                             begintijd,
                             lesDatum;
//private Klas klas;

public Les(){this(null,null,null,null,null,null);}

public Les(String nm, String lok, String doc, String dt, String et, String bt) {
    this.lesNaam   = new SimpleStringProperty(nm);
    this.lokaal    = new SimpleStringProperty(lok);
    this.docent    = new SimpleStringProperty(doc);
    this.begintijd = new SimpleStringProperty(et);
    this.eindtijd  = new SimpleStringProperty(bt);
    this.lesDatum  = new SimpleStringProperty(dt);
    //this.klas = kl;
}

public StringProperty lesNaamProperty()  {return lesNaam;}
public StringProperty lokaalProperty()   {return lokaal;}
public StringProperty docentProperty()   {return docent;}
public StringProperty begintijdProperty(){return begintijd;}
public StringProperty eindtijdProperty() {return eindtijd;}
public StringProperty datumProperty()    {return lesDatum;}

public void setLesNaam(String nm)  {this.lesNaam.set(nm);}
public void setLokaal(String lk)   {this.lokaal.set(lk);}
public void setDocent(String dc)   {this.docent.set(dc);}
public void setBegintijd(String bt){this.begintijd.set(bt);}
public void setEindtijd(String et) {this.eindtijd.set(et);}
public void setLesDatum(String dt) {this.lesDatum.set(dt);}
//public void setKlas(Klas kl) {klas = kl;}

public String getLesNaam()   {return lesNaam.get();}
public String getLokaal()    {return lokaal.get();}
public String getDocent()    {return docent.get();}
public String getBegintijd() {return begintijd.get();}
public String getEindtijd()  {return eindtijd.get();}
public String getLesDatum()  {return lesDatum.get();}
//public Klas getKlas() {return klas;}  
}

解组函数:

public void updateAbsentie(ObservableList<Student> st){
    List<File>filesInFolder = null;
    try {
        filesInFolder = Files.walk(Paths.get(path+"/data/saves/"))
                .filter(Files::isRegularFile)
                .map(Path::toFile)
                .collect(Collectors.toList());
    } catch (IOException e) {
        e.printStackTrace();
    }
    if(filesInFolder.size() !=  0){
        for(File file : filesInFolder) {
            if(file.getName().contains(".xml")){
                try {
                    JAXBContext context = JAXBContext.newInstance(PresentieLijstWrapper.class);
                    Unmarshaller um = context.createUnmarshaller();
                    PresentieLijstWrapper wrapper = (PresentieLijstWrapper) um.unmarshal(file);
                    System.out.println(wrapper.getLes());
                } catch (JAXBException e) {
                    e.printStackTrace();
                }

            }
        }
    }

我查看了许多其他 stackover 问题和一些教程。这是我主要关注的:http://code.makery.ch/library/javafx-8-tutorial/part5/

这是它所在的位置:

public void setles(Les lessen) { ... }

遵守 Java Beans 约定是必不可少的。如果 属性 的字段被称为 les,则 setter 必须被称为 setLes 而 getter getLesisLes 用于布尔值。因此:

public void setLes(Les lessen) { ... }