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

  • Home
  • SEARCH
  • 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 7746107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:11:40+00:00 2026-06-01T10:11:40+00:00

I have made a program that scans rss feeds. This same program creates feeds

  • 0

I have made a program that scans rss feeds. This same program creates feeds from elements it has crawled. This means that the rss feeds are not identical, but the items must be. It copies it. It is therefore essential that what comes out is the same thing that comes in.

Now, there are occurences where elmenents in the input rss’s has elements with names like this:

<dc:creator>tomatoes</dc:creator>

Now, when i scan this it works perfectly. The element get saved to database and everything is jolly good.

When i try to write it out again to an RSS feed, using these codelines (and a bunch of foreaches, if’s +++)

StringBuilder sb = new StringBuilder();
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.IndentChars = "  ";
settings.NewLineOnAttributes = true;
XmlWriter feedWriter = XmlWriter.Create(sb, settings);

And this line for each element:

feedWriter.WriteElementString(keyAndValue[0], keyAndValue[1]);

I get this error message if i hit the example element above:

Invalid name character in 'dc:creator'. The ':' character, hexadecimal value 0x3A, cannot be included in a name.

Now, i have found a lot of articles where this error has been mentioned. And in almost all of them they questioneer is told that this is not correct XML, and should drop writing the ‘:’. I however can’t.

I found one example where you could use another overloaded method of XmlWriter, this one:

feedWriter.WriteElementString(prefixAndKey[0],prefixAndKey[1],"Namespace",keyAndValue[1]);

However this causes the element to look like this:

<dc:creator xmlns:something="NameSpace">tomatoes</dc:creator>

This is, as you all know not the same as the one above because it contains the xmlns bit.

I also tried another ‘hack’ which would work as follows:

StringBuilder sb = new StringBuilder();
StringWriter stringWriter = new StringWriter(sb);
XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter);

and

feedWriter.WriteElementString(keyAndValue[0], keyAndValue[1]);

This built and did not return errors, but when i opend it in Firefox, it displayed 0 items.

I then took a closer look at the feed i was getting this elements from, and it contained a rss element like this:

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">

I am currently trying to replicate this.

Is there a reason why this might work? why?
Is there an easier way to do this?
Do i have to add a xmlns:dc or xmlns:itunes or whatever tag for all the different kinds of tags there is out there?

I need a simple and secure way of dealing with this, no matter what comes in the input rss feeds.

  • 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-06-01T10:11:41+00:00Added an answer on June 1, 2026 at 10:11 am

    A quick snippet with XDocument:

        XNamespace dc = @"http://purl.org/dc/elements/1.1/";
    
        XElement doc = new XElement("items", 
            new XAttribute(XNamespace.Xmlns + "dc", dc),
            new XElement("item",
              new XElement("title", "test"),
              new XElement(dc + "creator", "tomatoes"))) ;
    

    Gives

    <items xmlns:dc="http://purl.org/dc/elements/1.1/">
      <item>
        <title>test</title>
        <dc:creator>tomatoes</dc:creator>
      </item>
    </items>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm learning java and I have made simple program that simply reads value from
I have made a program that has a Toolbar with a few actions on
I have a pointer of a structure type that I made. On program start
I have made a program that continuously monitors a log file. But I don't
I have made a program that list all files and folders(f&f) locating on sd
Hi I have made a program that reads a text file containing words and
Hi i have made a simple program that plays a video file, i used
I have a made a simple program that reproduces the problem: #include <boost/archive/text_oarchive.hpp> #include
I have made a simple, test program to experiment using classes. It creates a
I have made a java GUI program and have added a jList on that

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.