Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 14th, 2004, 08:50 AM
Authorized User
 
Join Date: Jul 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML Serialization

Hi

I'm using XML Serialization for serializing an object. I read a set of records from the database and populate the members of the object if the value is not null. eg., I have an Employee object which has its members Id,name and address. If the Id is not null then I will populate its value from that I got from the databse. When I serialize the object , I find that xml structure will always have the Id column either with the actual value or with value 0 if the value is Null in the databse.
<employees>
<employee><Id>111</Id><name>aaa</name></employee>
<employee><Id>0</Id></name></employee>
</employees>

My feeling is this is the default behaviour of xml serializer for data types int, boolean and date and will have a value 0,0001-01-01 and false as default values respectively.

I cannot set the property <XmlElement(IsNullable:=True)> for value types. Is there any way where I can avoid serializing types of int,date and boolean when they have null values in the database.

Regards

RJN





Similar Threads
Thread Thread Starter Forum Replies Last Post
serialization taheernawaz ASP.NET 1.x and 2.0 Application Design 0 December 12th, 2007 03:32 AM
XML serialization is slower than Binary. Why ? navdeep General .NET 0 November 6th, 2007 06:14 AM
Serialization and DeSerialization balesh.mind ASP.NET 2.0 Professional 0 September 12th, 2007 05:05 AM
XML Header serialization problem PMNorris Pro VB.NET 2002/2003 0 January 5th, 2004 07:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.