将XML属性映射到Java属性
Is there a way to map xml attributes to Java attributes using Jackson Faster xml.
Sample xml
<student>
<details>
<element key="firstName" value="John" />
<element key="lastName" value="Doe" />
</details>
</student>
以上XML需要映射到Java类以下。
public class Student {
private String firstName;
private String lastName;
}
Is there a way to map xml attributes to Java attributes using Jackson Faster xml.
Sample xml
<student>
<details>
<element key="firstName" value="John" />
<element key="lastName" value="Doe" />
</details>
</student>
The above xml needs to be mapped to below Java class.
public class Student {
private String firstName;
private String lastName;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于这种情况,我编写了静态代码:
也注释您的DTO:
使用此方法后,您可以使用它来序列化数据:
for such cases, I have written a static piece of code:
Also annotate your DTO with:
After you have this method, you can use it to serialize your data: