开发者

Send ArrayList over the network - Convert Java ArrayList to XML String

开发者 https://www.devze.com 2023-02-23 03:35 出处:网络
I\'m new to Java. I want to send an array (A开发者_StackOverflow社区rrayList) of objects over the network via Java Web Service to my Silverlight app. This ArrayList contains custom class objects:

I'm new to Java. I want to send an array (A开发者_StackOverflow社区rrayList) of objects over the network via Java Web Service to my Silverlight app. This ArrayList contains custom class objects:

ArrayList<SVNSearchResult> results

so I'm thinking the best way is to serialize this to an XML String and on the Silverlight part, use LinQ to parse it. If there's a better way to send it please let me know. Thanks.


XML is a good fit for this. JSON would be one of the other usual suspects these days.

Whatever format you end up choosing, make sure you get the encoding right.


For a starter, try JSON. It has a network-efficient format, and is supported by any major language in the world.

XML is only my second choice as it is more complicated to generate/parse and is more verbose.

0

精彩评论

暂无评论...
验证码 换一张
取 消