我可以使用所有xmlns
创建属性,但无法创建非xmlns
下面的属性,例如ft:record="true" ft:status=""...
我扫描了java doc和整个网络但无法找到使用JAX-B将非xmlns
属性添加到架构标头的解决方案或方法。 JAX-B有任何规定吗?
<myaccount str:strns="true" ft:record="true" ft:status="" ft:num="0" xmlns:str="urn:ins.com:qmodel:wcpsstructs:v1">
</myaccount>
以下是我的package-info.java
:
@XmlSchema(namespace = "urn:ins.com:qmodel:wcpsstructs:v1",
elementFormDefault = XmlNsForm.QUALIFIED,
xmlns={
@XmlNs(namespaceURI="urn:ins.com:qmodel:wcpsstructs:v1", prefix = "str")
})
package com.mypackage.domain.outputspec;
import javax.xml.bind.annotation.*;
My Maven依赖项:
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.7</version>
</dependency>