开发者

Optimal way to convert XML to Objects

I'm creating an app on Google App Engine using Java, which accepts a standard XML file and maps it to an object- which is then saved to the datastore.

I'm expecting quite 开发者_运维问答a bit of entries/day (about 500+).. What is the optimal way of serializing xml, considering the cost in CPU and Data quotas of GAE/j?


If your view of optimal is the simplest way of serialising/deserialising (and in this instance I suggest it is), then take a look at XStream, which can convert POJOs to/from XML without any annotations/interface requirements etc.


Let's imagine you get 86,400 entries in a day - over 100 times as much as the 500 you mention. That's still only one per second, on average - and a second is a very long time in CPU terms. Of course, if each of these XML files is several gigabytes in size, then 500 of them is going to be quite a lot to handle. How big are these files likely to be?

Basically, this sounds like a non-problem. Find the simplest code you can (which will depend on what else you're doing), work out a budget in terms of how much CPU and data you're content to use, and then benchmark what you've got to decide whether it's good enough or not.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜