I have to export one c# class into a xml file which should be in the atompub format. I've read a lot of articles, but i still don't understand the main thing - how am i going to represent my class data ( properties information) in the xml file
Asked
Active
Viewed 1,771 times
1
-
Which version of .Net are you using and can you paste an example of your class? – user7116 Nov 02 '11 at 15:55
-
im using .net 4.0, i thought i will use the xmlwriter, to write the the xml file, but still don't understand how to organize it. The class structure is simple, two constructors(default and one with 2 params) and just e few properties from type string,Guid and object – d1mitar Nov 02 '11 at 15:56
-
Definitely atompub, not Atom RSS xml? (just making sure) – Lloyd Nov 02 '11 at 15:58
-
I am facing the same issue. I want to serialize/convert my c# class object into OData AtomPub or Odata Json (with metadata). Unfortunately I didn't any library to accomplish this task. Did you succeed? – Haider Feb 27 '14 at 10:20
1 Answers
2
The System.ServiceModel.Syndication
namespace contains a "serializer" to both atompub and rss. I use those classes in a project of mine, which is Open Source, so here's the link:
https://github.com/flq/Rf.Sites/blob/master/Rf.Sites/Features/Models/FeedModel.cs
Basically you create SyndicationItem
s which you put into a SyndicationFeed
. From a feed you can obtain an Atom10 or Rss20 Formatter which you combine with an XmlTextWriter to get your output.

flq
- 22,247
- 8
- 55
- 77
-
Atom RSS and Atompub are not one in the same. http://en.wikipedia.org/wiki/Atom_(standard), "The Atom Syndication Format is an XML language used for web feeds, while the Atom Publishing Protocol (AtomPub or APP) is a simple HTTP-based protocol for creating and updating web resources." – Lloyd Nov 02 '11 at 17:39