TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ajay Patel
NA
147
255.2k
XML Serialization issue
Jun 25 2013 6:57 AM
Hello,
When I serialize the XML with tag name including colon, then I get following result after serialization
<?xml version="1.0" encoding="utf-16"?>
<Test
_x003A_
11 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<str1>A1:A#</str1>
<str2>A2</str2>
<str3>A3</str3>
</Test
_x003A_
11>
I have following code to generate this XML.
test tc = new test() { str1 = "A1:A#", str2 = "A2", str3 = "A3" };
var serializer = new XmlSerializer(typeof(test));
var memoryStream = new MemoryStream();
var streamWriter = new StreamWriter(memoryStream, System.Text.Encoding.Unicode);
serializer.Serialize(streamWriter,tc);
Byte[] utf8EncodedXml = memoryStream.ToArray();
var stream = new StreamReader(new MemoryStream(utf8EncodedXml));
var cs = stream.ReadToEnd();
[XmlRoot("Test
:
11")]
public class test
{
public string str1 { get; set; }
public string str2 { get; set; }
public string str3 { get; set; }
}
Reply
Answers (
7
)
Transform c#
using Ado.Net with ReportViewer