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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:18:49+00:00 2026-05-17T21:18:49+00:00

Below is the schema I am trying to conform to: <?xml version=1.0?> <rss version=2.0

  • 0

Below is the schema I am trying to conform to:

  <?xml version="1.0"?>
  <rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">
  <channel>
     <title>The name of your data feed</title>
     <link>http://www.example.com</link>
     <description>A description of your content</description>
     <item>
       <title>Red wool sweater</title>
       <link> http://www.example.com/item1-info-page.html</link>
       <description>Comfortable and soft ...    cold winter nights.</description>
       <g:image_link>http://www.example.com/image1.jpg</g:image_link>
       <g:price>25</g:price>
       <g:condition>new</g:condition>
       <g:id>1a</g:id>
     </item>
  </channel>
  </rss>

Below is what I have been able to produce:

<?xml version="1.0"?>
<rss version="2.0" xmlns:g="http://base.google.com/ns/1.0">
  <channel>
    <title>The name of your data feed</title>
    <link>http://www.google.com</link>
    <description>A description of your content</description>
    <item>
      <title>Red Wool Sweater</title>
      <link>http://www.google.com/Red-Wool-Sweater</link>
      <description>Comfortable and soft, this sweater will keep you warm on those cold winter nights.</description>
      <g:image_link>http://www.example.com/image1.jpg</g:image_link>
      <g:price>25</g:price>
      <g:condition>new</g:condition>
      <g:id>1a</g:id>
    </item>
  </channel>
</rss version="2.0">

Below is the code that I wrote to achieve this (the above):

    // create and instantiate the writer object.
    XmlTextWriter xw = new XmlTextWriter("Products.xml", null);

    // use indenting.
    xw.Formatting = Formatting.Indented;

    // write the start of the document.
    xw.WriteStartDocument();

    xw.WriteStartElement("rss version=\"2.0\"");

    xw.WriteAttributeString("xmlns", "g", null, "http://base.google.com/ns/1.0");

    xw.WriteStartElement("channel");

    xw.WriteElementString("title", "The name of your data feed");
    xw.WriteElementString("link", "http://www.google.com");
    xw.WriteElementString("description", "A description of your content");

    xw.WriteStartElement("item");

    xw.WriteElementString("title", "Red Wool Sweater");
    xw.WriteElementString("link", "http://www.google.com/Red-Wool-Sweater");
    xw.WriteElementString("description", "Comfortable and soft, this sweater will keep you warm on those cold winter nights.");
    xw.WriteElementString("g:image_link", "http://www.example.com/image1.jpg");
    xw.WriteElementString("g:price", "25");
    xw.WriteElementString("g:condition", "new");
    xw.WriteElementString("g:id", "1a");

    // write the end element.
    xw.WriteEndElement();
    xw.WriteEndElement();
    xw.WriteEndElement();
    // write the end of the document.
    xw.WriteEndDocument();

    // close the writer.
    xw.Close();
    // press enter to exit.
    Console.ReadKey();

Those with eager eyes, will have spotted the problem I am having conforming to the google product feed schema … “the closing rss tag element” … is wrong. I have managed to replicate alot of it so far but that closing tag eludes. Can you guys help?

Also, feel to free to change my code if I have done anything wrong or gone about doing it the wrong way? Cheers.

  • 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-17T21:18:49+00:00Added an answer on May 17, 2026 at 9:18 pm

    What if, instead of doing this:

    xw.WriteStartElement("rss version=\"2.0\"");
    xw.WriteAttributeString("xmlns", "g", null, "http://base.google.com/ns/1.0");
    

    You did something like this:

    xw.WriteStartElement("rss");
    xw.WriteAttributeString("version", "2.0");
    xw.WriteAttributeString("xmlns", "g", null, "http://base.google.com/ns/1.0");
    

    I’ve never used XmlTextWriter before, but I’d think you should be able to add the version attribute after creating the rss tag, based on your code example. (Might wanna double-check my syntax)

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

Sidebar

Related Questions

My spring-context file is shown below. <beans xmlns=http://www.springframework.org/schema/beans xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:aop=http://www.springframework.org/schema/aop xmlns:jee=http://www.springframework.org/schema/jee xmlns:jms=http://www.springframework.org/schema/jms xmlns:lang=http://www.springframework.org/schema/lang xmlns:tx=http://www.springframework.org/schema/tx
I'm trying to implement a very simple XML schema constraint. The idref attribute on
In my XML schema definition, I'm trying to restrict the value of an attribute
I'm trying to create a BizTalk Schema that looks something like the below (ignore
I'm trying to make NHibernate generate my schema/SQL 2008, and using the mapping below
Below is my (simplified) schema (in MySQL ver. 5.0.51b) and my strategy for updating
Below I have a very simple example of what I'm trying to do. I
Below is part of the XML which I am processing with PHP's XSLTProcessor :
I'm writing an XSD schema for a project I'm working on. The schema below
I'm trying to build a Hibernate layer for a database schema I have essentially

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.