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 8660729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:19:43+00:00 2026-06-12T16:19:43+00:00

I’m looking to create a program to write an rss file for iTunes Podcast.

  • 0

I’m looking to create a program to write an rss file for iTunes Podcast. I know you can buy one, but this is for experience and for a non profit organization. here is my C# code

XDocument doc = XDocument.Load(fileLocation);
        XNamespace itunes = "http://www.itunes.com/dtds/podcast-1.0.dtd";


        XElement root = new XElement("item",
        (new XElement("title", textBoxPodcastTitle.Text)),
        (new XElement(itunes + "author", textBoxAuthor.Text)),
        (new XElement(itunes + "subtitle", textBoxSubtitle.Text)),
        (new XElement(itunes + "summary", textBoxSummary.Text)),
        (new XElement("enclosuer",
                    new XAttribute("url", "\"http://www.jubileespanish.org/Podcast/\"" + textBoxFileName.Text + "\"" + " length=\"" + o_currentMp3File.Length.ToString() + "\" type=\"audio/mpeg\""))),
        (new XElement("guid", "http://www.jubileespanish.org/Podcast/" + textBoxFileName.Text)),
        (new XElement("pubDate", o_selectedMP3.currentDate())),
        (new XElement(itunes + "duration", o_selectedMP3.MP3Duration(openFileDialogFileName.FileName.ToString()))),
        (new XElement("keywords", textBoxKeywords.Text)));

        doc.Element("channel").Add(root);
        doc.Save(fileLocation);

everything works fine except when I am writing the root XElement I made. It cannot write it because in the iTunes channel element there are other elements besides the “item” elements.(The rest of the podcast info). How can I append it inside the channel element but right before the closing tag. Here is how the xml file looks like. Thanks, I’m new be gentle…

<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
<channel>
     <title>Non Profit company</title>
     <itunes:keywords>keywords</itunes:keywords>
     <itunes:image href="http://www.podcast.org/Podcast/podcastlogo.png" />
     <itunes:explicit>no</itunes:explicit>
     <itunes:block>no</itunes:block>


<item>
  <title>Red, Whine, &amp; Blue</title>
  <itunes:author>Various</itunes:author>
  <itunes:subtitle>Red + Blue != Purple</itunes:subtitle>
  <itunes:summary>This week we talk about surviving in a Red state if you are a Blue person. Or vice versa.</itunes:summary>
  <itunes:image href="http://example.com/podcasts/everything/AllAboutEverything/Episode3.jpg" />
  <enclosure url="http://example.com/podcasts/everything/AllAboutEverythingEpisode1.mp3" length="4989537" type="audio/mpeg" />
  <guid>http://example.com/podcasts/archive/aae20050601.mp3</guid>
  <pubDate>Wed, 1 Jun 2005 19:00:00 GMT</pubDate>
  <itunes:duration>3:59</itunes:duration>
  <itunes:keywords>politics, red, blue, state</itunes:keywords>
</item>

</channel>
</rss>

I would like to append right before the

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-06-12T16:19:44+00:00Added an answer on June 12, 2026 at 4:19 pm

    This should work:

            doc.Root.Element("channel").Add(root);
    

    Element retrieved by accessing the Root property is rss and the Add method will add the element to the end of the element’s content by default.

    Other possible ways to do this would be:

            doc.Element("rss").Element("channel").Add(root);
    

    or:

            var el = doc.Descendants("channel").FirstOrDefault();
            if (el != null)
                el.Add(root);
    

    But the first one (using Root property) would be the cleanest.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
This could be a duplicate question, but I have no idea what search terms
I know there's a lot of other questions out there that deal with this
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and

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.