Error In Xml Document 1 1
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company there is an error in xml document (1 540) Business Learn more about hiring developers or posting ads with us Stack Overflow Questions c# there is an error in xml document Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers,
There Is An Error In Xml Document (1 2). C#
just like you, helping each other. Join them; it only takes a minute: Sign up Deserialization error in XML document(1,1) up vote 6 down vote favorite I have an XML file that I deserialize, the funny
Deserialize Error In Xml Document
part is the XML file is the was serialized using the following code: enter code here var serializer = new XmlSerializer(typeof(CommonMessage)); var writer = new StreamWriter("OutPut.txt"); serializer.Serialize(writer, commonMessage); writer.Close(); And i m trying to deserialized it again to check if the output match the input. anyhow here is my code to deserialize: var serializer = new XmlSerializer(typeof(CommonMessage)); var reader = new StringReader(InputFileName); CommonMessage commonMessage = (CommonMessage)serializer.Deserialize(reader); c# xml-deserialization share|improve this question edited Jan 18 there is an error in xml document (1 40). c# '11 at 16:17 asked Jan 18 '11 at 16:06 jprbest 27931226 3 Have you serialized it using one encoding and now are trying to deserialize with another encoding? –Oded♦ Jan 18 '11 at 16:08 no here is what i use the serialized var serializer = new XmlSerializer(typeof(CommonMessage)); var writer = new StreamWriter("OutPut.txt"); serializer.Serialize(writer, commonMessage); writer.Close(); –jprbest Jan 18 '11 at 16:13 @jprbest - if you want to add information, please edit the question and add the detail there instead of a comment. –Oded♦ Jan 18 '11 at 16:14 ok sorry i ll do it write now –jprbest Jan 18 '11 at 16:15 1 from my experience, error at (1,1) most often results from me opening a document with a notepad and accidentally putting a space or a new line at the top. –THX-1138 Jan 18 '11 at 16:20 | show 1 more comment 2 Answers 2 active oldest votes up vote 16 down vote accepted Replace StringReader with StreamReader and it will work fine. StringReader reads value from the string (which is file name in your case). share|improve this answer answered Jan 18 '11 at 17:03 Alexei Levenkov 71.1k55398 2 this was the problem because the stream reader/writer encode/decode using UTF 8 while string reader/writer encode/decode usng UTF 16 –jprbest Jan
to
There Is An Error In Xml Document (0 0). C#
Object Deserilization) .NET Framework > .NET Framework Class Libraries there is an error in xml document (3 2) Question 0 Sign in to vote Dear all, While converting the XML to c# deserialize there is an error in xml document (2 2) Object i am getting the error as There is an error in XML document (1, 1). here i am attaching my http://stackoverflow.com/questions/4726208/deserialization-error-in-xml-document1-1 xml and code . please help me how to deserialize the xml into object my XML
DOWNLOAD: C# Corner Android App Version http://www.c-sharpcorner.com/forums/there-is-an-error-in-xml-document 0.5.3 Released C# Corner Annual Conference 2017 Announced Forums - http://kristofmattei.be/2012/06/10/deserializing-xml-data-at-the-root-level-is-invalid-line-1-position-1-and-there-is-an-error-in-xml-document-1-1/ C# Corner C# Corner Home Technologies Monthly Leaders ASK A QUESTION C# Programming Multi-threading IoT Coffee, Chai Lounge HTML, JavaScript, CSS .NET General Office Interoperability Microsoft Surface Community Services iPhone, iPad Active Directory Printing ReFS Current Affairs Java ADO.NET & Database Project error in Management Silverlight 5 Fun and Jokes JQuery AJAX & Atlas Remoting WCF Job Opportunities JSP Algorithms & AI Reporting Windows 8 Leadership Multimedia, Graphics, Flash Arrays & Collections Robotics and Hardware Windows Azure Mac for Windows Node.js ASP.NET & Web Development Security & Cryptography Windows Store Apps Microsoft Feedback PHP C# Language Setup error in xml & Deployment Workflow Foundation Open Source Projects Social Networking C# References Sharepoint WPF Operating Systems TypeScript CLR & .NET Internals Speech & Voice Recognition XAML Language Paid Projects Web Hosting COM Interoperability Tablet PC Site and Forums Feedback Prizes, Awards, MVP Website Management Custom Controls Testing and QA Announcements Students & Beginner Projects Windows Phone 7 Design and Architecture Visual Basic .NET Author Guidelines Test Category Database Embedded Development Visual C++ Bugs and Problems Training & Certification Database General Enterprise Development Visual Studio 11 Forums Feedback Web Development Oracle Games, DirectX, and XNA Visual Studio 2010 Site Feedback & Suggestions Advertising, Marketing, SEO SQL GDI+ and DirectX Web Services Site Spams Android SQL Server General Windows Forms Miscellaneous AngularJS Products LINQ Windows Services .NET Books Cloud Computing Office 2013 Migrating to .NET Cutting-Edge Ask the Author Expression Tools Products Mobile Development .NET 5.0 Career Advice HTML 5 SharePoint 2013 Forum guidelines Home C# Language There
a configuration needed to be stored in the database. He would serialize the data with the following code: public static class XmlSerializerHelper { public static string SerializeXml