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.
我有这门课
public class Header { @XmlAnyElement(lax = true) protected List<Object> any; // getters/setters omitted }
我如何(在 JAX-WS WebMethod 中)在标题中创建一个看起来像这样的元素 ID?
<Header> <ID>value</ID> </Header>
您可以有一个如下所示的类并将其实例添加到any属性中,或者您可以将org.w3c.dom.Element表示ID元素的实例添加到集合中。
any
org.w3c.dom.Element
ID
@XmlRootElement(name="ID") @XmlAccessorType(XmlAccessType.FIELD) public class ID { @XmlValue private String value; }