Click here to Skip to main content
15,566,394 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am sending a XML over an TCP connection to a server. When the server responds, it sends me the following XML.

"<uxml_err STATUS='12509'/>?

I am trying to serialize that to my class, with the structure as follow:

<pre lang="c#">
[XmlRoot(ElementName = "uxml_err", Namespace = "")]
public class error
    [XmlAttribute(AttributeName = "STATUS")]
    public string STATUS;
    public override string ToString()
        return STATUS;

by trying this, I get the following Error: There is an error in xml document (1, 27). I think I know why this might occur, it might be because the XML I receive in response does not contain the following information at the top of the XML.

<?xml version="1.0" encoding="utf-8" ?> 

Is there anyway I can work around this, or is there anything else that I am doing wrong?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900