Generate custom RSS/Atom feed with SyndicationFeedFormatter made from XML
I have followed this article and implemented my service and I can open the web browser and see the test data being published. I would like to create a custom formatted response, as for my needs this will not be published to the internet and it's an isolated f开发者_如何学运维eed that other devices on the local network could read to get the data I'm publishing.
I'd like to create an XML document and publish it instead of using the SyndicationItem that is being used in the article to display title, author, description, etc.
Would like to create something simple to be published:
<MyData>
<ID>33883</ID>
<Title>The Name</Title>
<Artist>The Artist</Artist>
</MyData>
I know how to create that in an XMLWriter, but how to publish in a SyndicationFeedFormatter that is the return type for the function in the article?
I have seen the XmlSyndicationContent class but haven't seen any practical examples that would accomplish what I want to do.
I found this article which explains how to expose custom XML data in the content area of the RSS items. This is what I needed which allows me to create a class with the friendly names and just pass that class in and all the properties are exposed as custom XML.
精彩评论