Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5937123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:29:42+00:00 2026-05-22T15:29:42+00:00

How can I generate Atom Feed which will contain the namespaces displayed in the

  • 0

How can I generate Atom Feed which will contain the namespaces displayed in the image below? All the nodes of the Atom feed have to start with “a:”.

enter image description here

Here is what I am doing right now, however it doesn’t work.

    SyndicationFeed feed = new SyndicationFeed();
    XmlQualifiedName key = new XmlQualifiedName("os", "xmlns");
    feed.AttributeExtensions.Add(key, "http://a9.com/-/spec/opensearch/1.1/");

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:29:42+00:00Added an answer on May 22, 2026 at 3:29 pm

    I believe it should be

    SyndicationFeed feed = new SyndicationFeed();
    XmlQualifiedName key = new XmlQualifiedName("os", "http://www.w3.org/2000/xmlns/");
    feed.AttributeExtensions.Add(key, "http://a9.com/-/spec/opensearch/1.1/");
    

    UPDATE:

    After reading your question more carefully, I believe you could accomplish this by overriding the WriteStartElement and WriteStartAttribute methods of the XmlWriter instance used by the Atom10FeedFormatter. You can do this by implementing a custom XmlWriter class like the example below.

    class AtomXmlTextWriter : XmlTextWriter
    {
        private const string Atom10XmlNs = "http://www.w3.org/2005/Atom";
        private const string Atom10XmlNsPrefix = "a";
    
        public AtomXmlTextWriter(String filename, Encoding encoding)
            : base(filename, encoding)
        {
        }
    
        public override void WriteStartElement(string prefix, string localName, string ns)
        {
            base.WriteStartElement(GetAtomPrefix(ns), localName, ns);
        }
    
        public override void WriteStartAttribute(string prefix, string localName, string ns)
        {
            base.WriteStartAttribute(GetAtomPrefix(ns), localName, ns);
        }
    
        internal string GetAtomPrefix(string ns)
        {
            string prefix = string.Empty;
    
            if ((ns != null) && (ns.Equals(Atom10XmlNs)))
                prefix = Atom10XmlNsPrefix;
    
            return prefix;
        }
    }
    

    Using your custom class with the Atom10FeedFormatter

    SyndicationFeed feed = new SyndicationFeed();
    feed.AttributeExtensions.Add(new XmlQualifiedName("os", "http://www.w3.org/2000/xmlns/"), 
                                 "http://a9.com/-/spec/opensearch/1.1/");
    
    feed.AttributeExtensions.Add(new XmlQualifiedName(null, "http://www.w3.org/2000/xmlns/"),
                                 http://schemas.zune.net/catalog/apps/2008/02");
    
    using (XmlWriter writer = new AtomXmlTextWriter(@"TestFeed.xml", Encoding.UTF8))
    {
        Atom10FeedFormatter feedFormatter = new Atom10FeedFormatter(feed);
        feedFormatter.WriteTo(writer);
    }
    

    produces the desired output

    <a:feed xmlns:os="http://a9.com/-/spec/opensearch/1.1/" 
            xmlns="http://schemas.zune.net/catalog/apps/2008/02" 
            xmlns:a="http://www.w3.org/2005/Atom">
        <a:title type="text" />
        <a:id>uuid:0f1b2c84-c935-459e-bc89-79d06b5a976b;id=1</a:id>
        <a:updated>2011-05-21T17:07:46Z</a:updated>
    </a:feed>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this table where I can generate dynamic rows (which has input <type=text
I have a R function which can generate the LaTeX code (the output is
I have a application built in Silverlight, which will run on a ATOM processor
I know you can generate all permutations from a list, using glob or Algorithm::Permute
I'm looking for a tool which can generate a Makefile for a C/C++ project
I have a HQL query that can generate either an IList of results, or
I can generate a few lines of code that will do this but I'm
The program below can generate random data according to some specs (example here is
I'm creating an RSS (and/or Atom) feed for my website. Now, I can immediately
I'm looking for an algorithm which can generate a short (fx 16 chars (not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.