473,326 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

XmlSerializer and Chars

When serializing an object that has a Char as a property, the Char is converted into an Integer for some reason. See following code

Private Sub RunThisExample(

Dim myLetters As Letters = New Letter
myLetters.Letter = "W
Dim strFile As String = "C:/Testing.xml

Dim myXmlSerializer As New System.Xml.Serialization.XmlSerializer(myLetters.G etType
Dim myFileStream As New System.IO.FileStream(strFile, System.IO.FileMode.Create
Dim myXmlTextWriter As New System.Xml.XmlTextWriter(myFileStream, System.Text.Encoding.Unicode
myXmlSerializer.Serialize(myXmlTextWriter, myLetters

End Su

Public Class Letter
Dim _Letter As Cha
Public Property Letter(
Ge
Return _Lette
End Ge
Set(ByVal Value
_Letter = Valu
End Se
End Propert
End Clas

The results look like this

<?xml version="1.0" encoding="utf-16" ?><Letters xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Letter xmlns:q1="http://microsoft.com/wsdl/types/" xsi:type="q1:char">87</Letter></Letters

Notice that it has '87' instead of 'W'. Does anyone know how to fix this?
Jul 21 '05 #1
0 966

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Stuart Robertson | last post by:
I am trying to find a solution that will allow me to use XmlSerializer to serialize/deserialize a collection of objects where a given object is shared between two or more other objects, and not...
3
by: Loui Mercieca | last post by:
Hi, I have created a class, named FormField , which basically contains two fields, name and value. I have set the tag before the class and the field is set as an XmlAttribute whil the name as...
12
by: SJD | last post by:
I've just read Christoph Schittko's article on XmlSerializer: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/trblshtxsd.asp . . . and very informative it is too....
3
by: stax | last post by:
Hello, can somebody tell me how to serialize/deserialize a object containing a multi line string using the XmlSerializer class. One of the both windows linefeed chars get dumped somewhere down...
0
by: William Stacey [MVP] | last post by:
Had a method that got some string info from mp3 tags in N files and serializes this class and deserializes at other side. Works ok except sometimes get chars that choke the XmlSerializer. After...
0
by: RCIC | last post by:
When serializing an object that has a Char as a property, the Char is converted into an Integer for some reason. See following code Private Sub RunThisExample( Dim myLetters As Letters = New...
0
by: swatisahasrabudhe | last post by:
I have a class that I serialize/deserialize using xmlserializer. There are a few properties with char datatype. I have a few xml files from which I want to create the objects. While deserializing...
6
by: preport | last post by:
I have a webservice that returns data from a database. Our services (the clients) have been blowing up because of illegal character problems. Is there anything I can do on the server side to...
6
by: Andrew | last post by:
I am using an XmlSerializer to save some settings and I have discovered that when a string is saved containing a cr+nl it is replaced with just a newline when loading back in. I am no expert with...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.