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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:53:19+00:00 2026-05-31T21:53:19+00:00

I am trying to parse some XML, however, I get the error above this

  • 0

I am trying to parse some XML, however, I get the error above this sentence.

Here is my code:

     class Program
{


    static void Main(string[] args)
    {

        string xml = @"<?xml version=""1.0"" encoding=""UTF-8""?><rss version=""2.0"" xmlns:georss=""http://www.georss.org/georss"">
<channel>
    <title>asp.net Jobs in Boston, MA | Indeed.com</title>


    <link>http://www.indeed.com/q-asp.net-l-boston,-jobs.html</link>
    <description>Indeed.com - one search. all jobs. Search thousands of sites for asp.net Jobs in Boston, MA</description>
    <language>en</language>
    <copyright>Copyright (c) 2012 Indeed, Inc All rights reserved.</copyright>
    <lastBuildDate>Sun, 25 Mar 2012 19:43:15 GMT</lastBuildDate>
    <image>
        <url>http://www.indeed.com/images/indeed_rss.png</url>
        <title>Indeed.com - one search. all jobs.</title>
        <link>http://www.indeed.com/</link>
    </image>
    <item>
        <title>Software Engineer with ASP.Net applications experience - The Integrity Group -  Andover, MA</title>

        <link>http://www.indeed.com/job/Software-Engineer-With-ASP-Net-Application-Experience-at-The-Integrity-Group-in-Andover,-MA-6ab16ba39cc13536</link>
        <source>JobHost</source>
        <guid isPermaLink=""false"">d61c3504e9df0fc13be4abb4be209c38</guid>
        <pubDate>Wed, 21 Mar 2012 05:04:47 GMT</pubDate>
        <description>layers and preferably service based architecture. ASP.Net web applications with server-side controls and... Solid experience in ASP.Net, SQL Server, C#, XML, XML... &lt;br/&gt;
        From JobHost - 21 Mar 2012 05:04:47 GMT
        -  View all &lt;a href=&#034;http://www.indeed.com/l-Andover,-MA-jobs.html&#034;&gt;Andover jobs&lt;/a&gt;
        </description>

        <georss:point>42.64835 -71.15934</georss:point>
    </item>
</channel></rss>";

        foreach (SavedJob sj in GetJobs(xml))
        {
            Console.WriteLine(sj.title);
        }

    }

    public static List<SavedJob> GetJobs(string xml)
    {
        //http://forum.unity3d.com/threads/31314-Include-Files-in-build

        XmlDocument xmlDoc = new XmlDocument();
        System.IO.StringReader stringReader = new System.IO.StringReader(xml);
        stringReader.Read();

        //http://unity3d.qatohost.com/questions/161528/loading-a-large-xml-file-200-multi-level-nodes-int.html

        // skip BOM 
        xmlDoc.LoadXml(stringReader.ReadToEnd());

        List<SavedJob> SavedJobs = new List<SavedJob>();
        try
        {
            foreach (XmlElement found in xmlDoc.GetElementsByTagName("item"))
            {

                SavedJob sj = new SavedJob();
                sj.title = found.GetElementsByTagName("title")[0].InnerText;
                sj.link = found.GetElementsByTagName("link")[0].InnerText;
                sj.description = found.GetElementsByTagName("description")[0].InnerText;
                DateTime dt = new DateTime();
                DateTime.TryParse(found.GetElementsByTagName("pubDate")[0].InnerText, out dt);
                sj.date = dt;
                SavedJobs.Add(sj);
            }
        }
        //data source is null
        catch (Exception)
        {

        }

        return SavedJobs;

    }

}

public class SavedJob
{
    public string title { get; set; }
    public string link { get; set; }
    public string description { get; set; }
    public DateTime date { get; set; }
}

My goal is to create a loading panel in MonoTouch, however, I can’t seem to download the string because the XML is bad. Is there a way around this?

    LoadingView lv = new LoadingView ();

        WebClient wc = new WebClient ();
        wc.DownloadStringCompleted += delegate(object sender, DownloadStringCompletedEventArgs e) {
            // We got the async result now display data
            InvokeOnMainThread (delegate {
                if (e.Result != null) {
                    SavedJobs = basicOperations.GetJobs (e.Result);
                    TableView.Source = new DataSource (this);
                    TableView.ReloadData();
                    lv.Hide ();
                }
            });

        };

        lv.Show ("Loading");
        wc.DownloadStringAsync (new Uri (uString));
  • 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-31T21:53:21+00:00Added an answer on May 31, 2026 at 9:53 pm

    Your code shows:

        System.IO.StringReader stringReader = new System.IO.StringReader(xml);
        stringReader.Read();
        xmlDoc.LoadXml(stringReader.ReadToEnd());
    

    What this does is:

    • create a string reader on “”
    • then read the first character – “<“
    • then try to load the remaining characters as xml – i.e. “xml …>”

    So you need to avoid the initial stringReader.Read(); call which is stripping the first opening angle bracket from the xml – making it invalid at 1,1

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

Sidebar

Related Questions

Trying to parse some XML but apparently this is too much for a lazy
I'm trying to parse some xml files with lua and I'm stuck on this
I am trying to parse some currency data in xml format. Below code does
I'm trying to parse some XML from the USGS. Here's an example The parameterCd
I'm trying to parse some XML data to get the value of a certain
I am currently trying to parse some xml data into an NSDictionary . This
So I'm trying to parse some XML, the creation of which is not under
I am trying to parse some XML i have retrieved via e4x in an
im trying to parse the XML returned by Google contacts API i made some
I'm trying to parse some XML (html) I downloaded using WebRequest.Create() and then read

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.