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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:39:17+00:00 2026-06-13T09:39:17+00:00

i am trying to parse some xml that i beleve to be malformed using

  • 0

i am trying to parse some xml that i beleve to be malformed using Linq in .net 3.5 , i need to get the data out of the xml and insert the data into variables, i have been using XmlDocument to parse the xml, any examples or assistance is greatly appreciated

XML —

<?xml version="1.0" encoding="UTF-8"?>
<centovacast version="2.2.4" host="my.domain.com">
<response type="success">
<message>Complete</message>
<data><row>
<field name="mount">/stream</field>
<field name="listenercount">0</field>
<field name="genre">Unspecified</field>
<field name="url">http://</field>
<field name="title"></field>
<field name="currentsong">Placebo - One Of A Kind</field>
<field name="bitrate">128</field>
<field name="sourceconnected">1</field>
<field name="serverstate">1</field>
<field name="sourcestate">1</field>
<field name="reseller">0</field>
<field name="ipaddress"></field>
<field name="port">13282</field>
<field name="proxy">0</field>
<field name="servertype">ShoutCast</field>
<field name="sourcetype">icescc</field>
</row><row><field></field></row></data></response></centovacast>

another problem is that sometimes the “currentsong” value may contain special characters, such as ! , % , ^ & etc and i know that can sometimes cause issues with xml.

— Code i’m trying to use to parse the XML

        XElement xml = XElement.Parse(data);

        var query = from p in xml.Elements("name")
                    select p;

        foreach (var record in query)
        {
            MessageBox.Show(String.Format("Info: {0} {1}",
                                                record.Element("url"),
                                                record.Element("title")));
        }
  • 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-13T09:39:18+00:00Added an answer on June 13, 2026 at 9:39 am

    Linq2Xml code below works with your xml.

    var xDoc = XDocument.Parse(xml); //XDocument.Load(filename)
    
    var dict = xDoc.Descendants("field")
                   .Where(e=>e.HasAttributes)
                   .ToDictionary(e => e.Attribute("name").Value, e => e.Value);
    
    Console.WriteLine(dict["currentsong"]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some XML that I need to parse using SQL Server 2008. I
I'm trying to parse some XML data using jQuery, and as it stands I
I'm trying to parse some XML data to get the value of a certain
So, i'm trying to parse some xml that looks this way: <image size=extralarge> http://...
I am trying to parse some XML, however, I get the error above this
I am trying to use XDocument.Parse(string s) to parse some XML that is being
I'm trying to parse some XML (html) I downloaded using WebRequest.Create() and then read
I am trying to parse some xml data by passing the variables with a
I am trying to parse some XML that looks similar to this: <document> <headings>
I'm trying to parse some data that has every cell of a tabs in

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.