java - Take off namespace from Jaxb fields -
i want know how type 1 time namespace in jabx, because in every fields need put namespace.
the code below show it.
@xmlrootelement(name = "nfeproc", namespace = "http://www.portalfiscal.inf.br/nfe") @xmlaccessortype(xmlaccesstype.field) class nfeproc { @xmlelement(name = "nfe", namespace = "http://www.portalfiscal.inf.br/nfe") private nfe nfe; @xmlattribute(name = "versao") private string versao; public nfe getnfe() { return nfe; } public void setnfe(nfe nfe) { this.nfe = nfe; } public string getversao() { return versao; } public void setversao(string versao) { this.versao = versao; } }
i wanna put 1 time.
thanks
you can set @ package level using @xmlschema
annotation. setting element form default qualified, elements without namespace specified via annotation belong given namespace.
package-info.java
@xmlschema( namespace = "http://www.portalfiscal.inf.br/nfe", elementformdefault = xmlnsform.qualified) package example; import javax.xml.bind.annotation.xmlnsform; import javax.xml.bind.annotation.xmlschema;
for more information
Comments
Post a Comment