我有一个像这样的公司的xml文件:
<Employee>
<name>Vikram</name>
<department>Testing</department>
<Employee>
package com.company;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "Employee", namespace="Testing")
@XmlAccessorType(XmlAccessType.FIELD)
public class Employee implements Serializable {
//getters and setters
}
输出为:
<ns2:Employee xmlns="Testing">
<name>Vikram</name>
<department>Testing</department>
<ns2:Employee>
但我想要的输出是这样的:
<Employee xmlns="Testing">
<name>Vikram</name>
<department>Testing</department>
<Employee>
我想删除ns2前缀,但我不能采用package-info
方式。如果没有在根元素上添加ns2:
Instant.parse( "2012-05-31T13:48:04Z" )
.getEpochSecond()
作为前缀,JAXB是否还有其他任何方式。