Click here to Skip to main content
15,889,992 members
Home / Discussions / C#
   

C#

 
AnswerRe: VB6 ActiveX to push data to a C# Program Pin
Parwej Ahamad2-Oct-07 17:55
professionalParwej Ahamad2-Oct-07 17:55 
Questionint? Pin
seemamltn2-Oct-07 13:08
seemamltn2-Oct-07 13:08 
AnswerRe: int? Pin
Judah Gabriel Himango2-Oct-07 13:11
sponsorJudah Gabriel Himango2-Oct-07 13:11 
AnswerRe: int? Pin
Christian Graus2-Oct-07 13:11
protectorChristian Graus2-Oct-07 13:11 
QuestionHelp: NHibernate and SysCache2 [modified] Pin
emiaj2-Oct-07 12:27
emiaj2-Oct-07 12:27 
QuestionForce XmlSerializer.Deserilize to ignore empty XML tags Pin
eggie52-Oct-07 12:12
eggie52-Oct-07 12:12 
AnswerRe: Force XmlSerializer.Deserilize to ignore empty XML tags Pin
TJoe2-Oct-07 12:39
TJoe2-Oct-07 12:39 
GeneralRe: Force XmlSerializer.Deserilize to ignore empty XML tags [modified] Pin
eggie52-Oct-07 13:49
eggie52-Oct-07 13:49 
Sorry, But I'm a little overwhelmed. Maybe you can help me more if I'm more specific.

I have this XML that I'm trying to serilize into a ContentCampaign obj.:

<ContentCampaign xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<id>0</id>
<name>serilizatoin test</name>
<category_id>4</category_id>
<subject>i am subject</subject>
<body>i am body</body>
<birth>0001-01-01T00:00:00</birth>
<ad_id_source>4</ad_id_source>
<valid_after>0001-01-01</valid_after>
<billing_code>0</billing_code>
<created_at>0001-01-01T00:00:00</created_at>
<updated_at>0001-01-01T00:00:00</updated_at>
<notes></notes>
</ContentCampaign>

It works find until a field node is empty. For example <code><ad_id_source></ad_id_source></code>. This xml is generated from a database table and when a value is null it simple generates an empty xml node.

The problem with the empty ad_id_source node is tha now, when the deserializer runs, it throws an exception.

Simply, is there a way for the deserializer to ignore these empty nodes?

I noticed that if a node that maps to a string is empty is just defaults to null. Can I configure the deserilizer to set any empty nodes respective type to it's default value? eg. 0 for int, 0001-01-01 for DateTimes?


-- modified at 19:59 Tuesday 2nd October, 2007

/\ |_ E X E GG
GeneralRe: Force XmlSerializer.Deserilize to ignore empty XML tags Pin
TJoe2-Oct-07 15:16
TJoe2-Oct-07 15:16 
GeneralRe: Force XmlSerializer.Deserilize to ignore empty XML tags Pin
eggie52-Oct-07 15:43
eggie52-Oct-07 15:43 
QuestionCounter Pin
MasterSharp2-Oct-07 11:18
MasterSharp2-Oct-07 11:18 
AnswerRe: Counter Pin
Paul Conrad2-Oct-07 11:21
professionalPaul Conrad2-Oct-07 11:21 
GeneralRe: Counter Pin
MasterSharp2-Oct-07 11:21
MasterSharp2-Oct-07 11:21 
GeneralRe: Counter Pin
MasterSharp2-Oct-07 11:23
MasterSharp2-Oct-07 11:23 
GeneralRe: Counter Pin
Paul Conrad2-Oct-07 11:26
professionalPaul Conrad2-Oct-07 11:26 
AnswerRe: Counter Pin
Christian Graus2-Oct-07 13:10
protectorChristian Graus2-Oct-07 13:10 
QuestionIcon Pin
MasterSharp2-Oct-07 11:00
MasterSharp2-Oct-07 11:00 
AnswerRe: Icon Pin
Peter Vertes2-Oct-07 11:04
Peter Vertes2-Oct-07 11:04 
Questionplease help Pin
memaia2-Oct-07 10:46
memaia2-Oct-07 10:46 
AnswerRe: please help Pin
Dan Neely2-Oct-07 10:50
Dan Neely2-Oct-07 10:50 
AnswerRe: please help Pin
Colin Angus Mackay2-Oct-07 10:50
Colin Angus Mackay2-Oct-07 10:50 
AnswerRe: please help Pin
Paul Conrad2-Oct-07 10:50
professionalPaul Conrad2-Oct-07 10:50 
AnswerRe: please help Pin
zeeShan anSari2-Oct-07 10:50
zeeShan anSari2-Oct-07 10:50 
AnswerRe: please help Pin
Dave Kreskowiak2-Oct-07 11:04
mveDave Kreskowiak2-Oct-07 11:04 
GeneralRe: please help Pin
Paul Conrad2-Oct-07 10:52
professionalPaul Conrad2-Oct-07 10:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.