on 27-12-2011 08:59 PM
Well this is a rather noobish question, but I hope this could help others in the future, who want to download stuff from the web and eventually parse it (or process it any other way).
How would it be done the right way regarding the SDK; for instance when someone would like to deserialize XML content and work with it like a domain model?
I would be very grateful to get any feedback for my approach: Pastebin Sample
Is there anything that you'd done differently? Is my sample absurdly wrong and shouldn't be used in any case?
Thanks in advance for all feedback.
Solved! Go to Solution.
on 27-12-2011 09:30 PM
on 27-12-2011 09:39 PM
Yes there's luckily a good C# XML library included in the SDK and my sample uses exactly that.
I also took the HttpSample and modified it to get the desired result.
But I still wonder if I've done it right considering the "Playstation Suite" framework and it's domain. Am I using the main loop correctly? Does this approach result in any major limitation regarding GUI, etc.?
I'm just curious if it's the right way to go, because I'd continue using that approach and build my small app around that for the beginning. :-)
on 03-01-2012 01:54 PM
When it comes to XML there are many ways to skin a cat.
I do not see anything wrong with the approach you have taken. It uses the XML deserializer, which will work for many kinds of XML formatted content. As long as you control both the generation and the consumption side you wont have a problem.
If you were to process a third-party XML, it might very well be the case that you can not map the XML schema to the limited schema supported by the Xml Serializer (which was really designed for Document/Literal encoding).
If that is the case, you might have to resort to either using a streaming parsing API (XmlReader) or using the in-memory modules (the sexy XDocument or the old and busted XmlDocument).
That said, when it comes to trasfering data to these devices, keep in mind that you might be running on a pretty bad network connection. That the user might be moving from his WiFi at home to a 3G on the road and might even hit spots with bad reception.
This means that you should try to make the data that is exchanged as small as possible.
Try to use gzip compression on the server, and force your client code to request Gzip transfers (see my TweetStation code on GitHub to see how I force Twitter to send me Gzip data).
You might also want to go with Json for encoding, as this is a lighter protocol.
In fact, if you want lighter, you might want to consider protocol buffers.
Website ©2013 Sony Computer Entertainment Europe
All content, game titles, trade names and/or trade dress, trademarks, artwork and associated imagery are trademarks and/or copyright material of their respective owners. All rights reserved. [more info]