JAXB问题: 当我的package.Info是:
@javax.xml.bind.annotation.
XmlSchema(
namespace = "myUrl...",
location = "myUrl ignoreme.xsd",
xmlns = {
@XmlNs(namespaceURI = "myUrl/", prefix = "")
},
elementFormDefault = XmlNsForm.QUALIFIED
我得到了:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MyRoot xmlns="myURI..." >
<other elements.... >
</MyRoot>
当我在package-info中调整行:
@XmlNs(namespaceURI = "myUrl/", prefix = "ns2")
我得到了:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:MyRoot xmlns:ns2="myURI..." >
<other elements.... >
</ns2:MyRoot>
但是我只想要ns2如下(不是在每个标签的开头:)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MyRoot xmlns:ns2="myURI..." >
<other elements.... >
<MyRoot>
怎么做?