java - xml 傳輸數據如何處理更好
問題描述
項目要使用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。
相關文章:
1. javascript - node.js promise沒用2. golang - 用IDE看docker源碼時的小問題3. c++ - 如何正確的使用QWebEngineView?4. yii2中restful配置好后在nginx下報404錯誤5. javascript - js 寫一個正則 提取文本中的數據6. 算法 - python 給定一個正整數a和一個包含任意個正整數的 列表 b,求所有<=a 的加法組合7. android 如何實現如圖中的鍵盤上的公式及edittext的內容展示呢8. java - 我在用Struts2上傳文件時,報以下錯誤怎么回事?9. 請問是對象還是數組10. thinkphp6使用驗證器 信息如何輸出到前端頁面
