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

The Archive Base Latest Questions

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

I get an exception with the message: There is an error in XML document.

  • 0

I get an exception with the message: “There is an error in XML document”.

Code:

        private readonly SortedList<string, object> _attributes;

        [XmlArray("Attributes")] 
        [XmlArrayItem("AttributesLine", Type=typeof(DictionaryEntry))] 
        public DictionaryEntry[] _x_Attributes 
        { 
            get 
            { 
                DictionaryEntry[] ret = new DictionaryEntry[_attributes.Count]; 
                int i=0;
                foreach (KeyValuePair<string, object> stuffLine in _attributes)
                {
                    object value = stuffLine.Value;     // <--- float[]         
                    ret[i++] = new DictionaryEntry {Key = stuffLine.Key, Value = value};                
                }
                return ret; 
            }
            set
            {
                _attributes.Clear();
                foreach (DictionaryEntry entry in value)
                {
                    _attributes.Add((string) entry.Key, entry.Value);
                }
            }
        }

The value of each key/value pair is of type float[]. I still want the value type to remain ‘System.Object’ as some keys can have values of types other than float[] (In any case, I get the exception even when the dictionary is populated with one entry).

Edit to clarify: I’m using the ‘XmlSerializer’, which worked fine when entry.Value was a ‘float’.

  • 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-31T16:27:20+00:00Added an answer on May 31, 2026 at 4:27 pm

    I am assuming you are using the XMLSerializer, which can’t handle Generic Dictionary objects. I have seen that error being thrown when using Dictionaries myself. You need to choose one of the other serializers which can handle them.

    Try the DataContractSerializer instead.

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

Sidebar

Related Questions

I get this message when running the code below: There is an error in
When debugging I get an warning message on exception saying 'variable info not available
When I get an exception in code called by Silverlight whilst in debug mode
I am parsing this xml <Root><Status>1</Status><Message>Get call Successful</Message><StatusCode></StatusCode><Item type = 'all' subtype = '0'
I've got a Polish version of Windows installed and therefore I get exception messages
I get security exception when using System.Net.WebClient to do HTTP requests, which is due
I get this exception on my Windows 7 64bit in application running in VS
I get an exception thrown at runtime when I set AllowsTransparency=True I get an
why do i get this exception? Map myHash = null myHash = (HashMap)Collections.synchronizedMap(new HashMap());
When using Marshal.GetExceptionCode() how do you get the Exception Type and/or instance of the

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.