jaxb java中的xml架构未获得预期的输出

时间:2017-02-20 07:36:28

标签: java xml jaxb marshalling dhl

我的预期输出采用JAXB格式。

 <?xml version="1.0" encoding="utf-8"?>
<req:ShipmentRequest xmlns:req="http://www.dhl.com"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dhl.com ship-val-global-req.xsd" schemaVersion="5.0">
<Request>
<ServiceHeader>
  <MessageTime>2001-12-17T09:30:47-05:00</MessageTime>
  <MessageReference>1234567890123456789012345678901</MessageReference>
  <SiteID>CustomerTest</SiteID>
  <Password>alkd89nBV</Password>
</ServiceHeader>

</req:ShipmentRequest>

但我只能得到

<?xml version="1.0" encoding="utf-8"?>
<ShipmentRequest xmlns:req="http://www.dhl.com"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dhl.com ship-val-global-req.xsd" schemaVersion="5.0">
<Request>
<ServiceHeader>
  <MessageTime>2001-12-17T09:30:47-05:00</MessageTime>
  <MessageReference>1234567890123456789012345678901</MessageReference>
  <SiteID>CustomerTest</SiteID>
  <Password>alkd89nBV</Password>
</ServiceHeader>

</ShipmentRequest>

我如何添加像“req:”这样的前缀,如预期输出所示,因为我使用jaxb来编组和解组

0 个答案:

没有答案