Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我如何注释我的类来归档这个 xml 结构:
<elementTag attribute="false">Testvalue</elementTag>
我试图将 elementTag 放入一个单独的类中,但是“Testvalue”不像我的示例中那样是内联的。
谢谢和最好的问候,米
您可以使用@XmlValue注释。
@XmlValue
@XmlRootElement(name="elementTag") public class Root { @XmlAttribute public String getAttribute { return attribute; } @XmlValue public String getValue() { return value; } }