search

Home  >  Q&A  >  body text

java - How to handle xml transmission data better

The project needs to use xml to transmit data, for example:

<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>Please release after deduction</logisticsRemark>
</logisticsOrder>
</logisticsOrders>
</logisticsDetail>
</eventBody>
</logisticsEvent>
</logisticsEventsRequest>

The content of xml needs to be constructed. If you want to transmit json, create the object directly and then convert json. Now you want to transmit xml. Is there any convenient way?

習慣沉默習慣沉默2784 days ago607

reply all(2)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-17 10:02:35

    There are also tools for converting objects to xml, such as com.thoughtworks.xstream

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-17 10:02:35

    Baidu JAXB.

    reply
    0
  • Cancelreply