jaxb marshall字段为xml,其中内部元素具有属性但没有值

时间:2019-02-04 11:59:39

标签: jaxb

我有xml:

<people>
    <person ID="1">
        <surname>Petrov</surname>
        <name>Petr</name>
        <birthday>
            <day>5</day>
            <month>01</month>
            <year>1993</year>
        </birthday>
        <birthplace city="Moscow"/>
        <work>IBA</work>
    </person>
</people>

,我需要对此进行整理,但是我不知道我对“出生地”的处理方式。现在,我使用jaxB,这是我的People.class:

public class Person {
    @XmlAttribute(name = "ID")
     private String personId;
    @XmlElement
     private String surname;
    @XmlElement
     private String name;
    @XmlElement
     private Birthday birthday;
    ***@ ???***
     private String birthplace;
    @XmlElement
     private String work;
...

0 个答案:

没有答案