In my first post I wrote that I like XML processing with DataContract and CollectionDataContract.
I still think it is not bad however few days ago a came across an interesting issue.
My function returns an object, which is serialized automatically. It appeared that if the XML was too big (in my case about 6 MB) I received 504.
The problem solved by serializing inside the function and returning a Stream.
If anyone has a better solution I will be glad to hear it.