Can anyone recommend a .Net XML Serialization library (ideally open source).
I am looking for a robust XML serialization library that I can throw any object at, which will produce a human readable XML representation of the public properties for logging purposes.
- I never need to be able to deserialize.
- XmlSerializer's requirement of an object having a parameter constructor is too restrictive for what I want.
- DataContractSerializer does not give enough control over the output (which is not particularly human-readable).
Any recommendations appreciated!
Thanks
You could transform the XML using XLST.
2 that come to mind right away:
http://xsd2code.codeplex.com/
http://www.codeproject.com/KB/XML/yaxlib.aspx
It turned out that YaxLib has some of the same issue I was having with the XMLSerializer (it needs a parameterless constructor, and I had some issues with stack-overflow exceptions due to recursion).
In the end I went with json serialization using a library called json.net. I have been seriously impressed with this, and so far is has seemed way way more robust than any xml library i have tried, and very flexible too. The code is open source, and very impressive too. Kudos James Newton-King (the guy who wrote it). http://james.newtonking.com/projects/json-net.aspx