0
是否有人知道如何將屬性的值映射到字段。說郎標籤,這是「SW」到現場一類使用MOXy在XML中提取屬性值
<book category="cooking">
<title lang="sw">Vegetarian</title>
<year>2008</year>
<price>30.00</price>
<authors>
<author>Tichaona</author>
<author>Ngodza</author>
</authors>
</book>
......
......
......
<book category="Huffman Coding">
<title lang="en">Encryption</title>
<year>2000</year>
<price>45.00</price>
<authors>
<author>Ruvimbo</author>
</authors>
</book>
我希望能夠在屬性郎值投入使用莫西擴展字段的值。沿
@XmlPath("title/@lang")
private String language;
誰能幫
感謝克里斯蒂,我想知道爲什麼它需要2個正斜槓。我會嘗試。 – ngonidzashe
單個正斜槓用於根,雙意味着它將搜索不僅僅是直接孩子的元素。如果你需要那些使用Moxy的人,我實際上並不是100%確定的,但我會假設這條道路是相對於被編組的班級的根源的 – Christy