473,325 Members | 2,712 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,325 software developers and data experts.

Xml Serialization and Xml Encoding

Using Xml Serialization to serialize an object, how can i take control over
the finall Xml Encoding?

I mean, when i serialize an object, i always get something like that

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

and i need this (xml enconding = iso-8859-1)

== == ==
<?xml version="1.0" encoding="iso-8859-1"?>
<xxxxxx>
.. . . .
</xxxxxx>
== == ==

thanks

May 16 '06 #1
1 6339


Ricardo Quintanilla wrote:
Using Xml Serialization to serialize an object, how can i take control over
the finall Xml Encoding?
and i need this (xml enconding = iso-8859-1)


You serialize to an XmlTextWriter, don't you? There you can choose the
encoding when you create the XmlTextWriter
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemXmlXmlTextWriterClassctorTopic3.asp>
e.g.
XmlTextWriter xmlWriter = new XmlTextWriter("object.xml",
System.Text.Encoding.GetEncoding("ISO-8859-1"));

XmlSerializer serializer = new XmlSerializer(typeof(Whatever));
serializer.Serialize(xmlWriter, whatever);

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
May 16 '06 #2

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

Similar topics

3
by: Mark | last post by:
Hello, What I am trying todo is use .NET serialization to take a Guid property that is an attribute in the XML document and have its output to be the same as...
4
by: Jeff T. | last post by:
Hello, I have an existing set of C# classes that encapsulate our application data. They are in a heirachy with each subclass defining more specific types of data. I would like to serialize these...
0
by: psy000 | last post by:
Hi, I have a C# web service client that talks to a JAVA application sever. I use AXIS to generate the WSDL file, use wsdl.exe to generate proxy stub c# code. When I try to use c# client connect...
4
by: Brian Keating | last post by:
wonder if anyone can help me here, i've a framework 1.1 dataset which i serialize in framework 1.1 and deserialize in framework 2.0. This is fine, problem is that i want to modify some of the...
0
by: umhlali | last post by:
I get the following exception when my VB.NET app calls a Java web service that returns an array of objects. The same call works for a single object though. So looks like there is no problem...
0
by: Chris McDonough | last post by:
ElementTree's XML serialization routine implied by tree._write(file, node, encoding, namespaces looks like this (elided): def _write(self, file, node, encoding, namespaces): # write XML to file...
4
by: Val | last post by:
I have a complex object that I need to serialize. Rather than rely on a standard routine, which is called during the serialization/deserialization, I would like to be able to use my own functions...
1
by: Sarika Agarwal | last post by:
Hi, What is the primary difference between serialization and encoding in ..NET! *** Sent via Developersdex http://www.developersdex.com ***
2
by: Nishant Mehta | last post by:
Hi all, I am serialiizing a c# object to an XML file to save some application settings. The idea is to ship this xml file along with the application and deserialize after the application is...
2
!NoItAll
by: !NoItAll | last post by:
Reading XML in VB.NET is pretty straightforward. Create an XML Document Object, then you can load the XML and iterate through all of the nodes as required. You can search for nodes, use x-path,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
1
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: 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.