Tôi không thể hiển thị trong tệp xml tất cả tham số được định cấu hình bằng chú thích @xmlSchema ở cấp gói. Ví dụ, nếu tôi đặt:@xmlSchema chú thích sử dụng với jaxb
@javax.xml.bind.annotation.XmlSchema (
xmlns = {
@javax.xml.bind.annotation.XmlNs(prefix = "com",
namespaceURI="http://es.indra.transporte.common"),
@javax.xml.bind.annotation.XmlNs(prefix = "xsi",
namespaceURI="http://www.w3.org/2001/XMLSchema-instance"),
@javax.xml.bind.annotation.XmlNs(prefix = "ns2",
namespaceURI="http://es.indra.transporte.configuration"),
},
location = "http://es.indra.transporte.configuration StationNetwork.xsd",
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED
)
package es.indra.transporte.central.thalesinterface.common.beans;
tôi mong đợi để xem một cái gì đó như:
<stationNetwork xmlns:ns2="http://es.indra.transporte.configuration"
xmlns:com="http://es.indra.transporte.common"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://es.indra.transporte.configuration StationNetwork.xsd">
nhưng tôi nhận được kết quả như sau:
<stationNetwork xmlns:com="http://es.indra.transporte.common">
Những gì tôi đang làm sai? Làm cách nào tôi có thể nhận được kết quả mong đợi?
Tôi làm cách nào để đặt xmlns trên nút gốc bằng chú thích? Tôi trở về từ phương thức @Get của tôi với Response.ok (entity) .build(), và tôi không sử dụng marshaller trực tiếp. – neu242
Đừng bận tâm, @XmlSchema trong package-info.java đã hoạt động rất tốt. – neu242