您的位置:首頁技術文章
文章詳情頁

java - xml 傳輸數據如何處理更好

瀏覽:104日期:2023-12-13 13:51:49

問題描述

項目要使用xml傳輸數據,例如:

<logisticsEventsRequest><logisticsEvent><eventHeader><eventType> LOGISTICS _TMS_CONFIRM_DUTYS </eventType><eventTime>2013-08-24 08:00:00</eventTime><eventSource> STORECODE </eventSource><eventTarget>CP</eventTarget></eventHeader><eventBody><logisticsDetail><logisticsOrders><logisticsOrder><poNo>LP682343244</ poNo ><occurTime>2013-03-08</occurTime><confirmPaymethod>A</confirmPaymethod ><logisticsRemark>扣款后請放行</logisticsRemark></logisticsOrder> </logisticsOrders></logisticsDetail></eventBody></logisticsEvent> </logisticsEventsRequest>

xml 的內容要構建,如果傳輸 json,直接創建對象然后轉換json,現在要傳輸xml,有什么方便的方式么?

問題解答

回答1:

也有對象轉xml的工具啊, 比如com.thoughtworks.xstream

回答2:

百度JAXB。

標簽: java
相關文章:
国产综合久久一区二区三区