no worries on the redundancy, mate.
another newsgroup. Heh heh. ).
"Mark McConnell" <nbone> wrote in message
news:OX4NX6WdEHA.3632@TK2MSFTNGP09.phx.gbl...
> Dino,
>
> Thank you and I will give it a try!
>
> I read throught he newsgroup looking for similar questions so that I
> wouldn't be redundant, but I didn't find any that had matched my exact
> problem. Sorry for the redundancy and thank you for your help!!
>
> Mark
>
>
> "Dino Chiesa [Microsoft]" <dinoch@online.microsoft.com> wrote in message
> news:e4ej4iPdEHA.1652@TK2MSFTNGP09.phx.gbl...
> > Mark
> > This is an example of the "impedance mismatch" between W3C XML Schema
and
> > the .NET type system. W3C XML Schema says that Integers can be
nillable.
> > .NET says integers are value types, and may never have null values.
> >
> > But there is an easy way to handle it, using the xxxSpecified
convention.
> >
> > Here's an illustration. (using DateTime, not int. But the same
principle
> > applies. And my apologies: it is in C#. )
> >
>
http://www.winisp.net/cheeso/srcview.aspx?dir=xml-serialization&file=DateOptional.cs > >
> > If the Schema you are working from has a nillable="true" attribute on
the
> > field or fields in question, then the xsd.exe tool (part of .NET SDK)
will
> > properly generate the xxxSpecified fields tagged with [XmlIgnore] to
> handle
> > this situation. If your class does not have this, then either :
> > - your schema is broken
> > - the doc you have is not conformant to the schema (your doc is broken)
> > - you are not working from a schema at all.
> >
> > Ideally you would be able to fix the root cause.
> >
> > -Dino
> >
> > ps:
> > This is the third time in 3 days I have answered this question on this
> > newsgroup.
> >
>
http://groups.google.com/groups?q=dateoptional.cs&num=30&hl=en&lr=&ie=UTF-8&sa=N&tab=wg > > I guess we need to document it better. or publish an up-to-date FAQ
list.
> > Or something. Suggestions?
> >
> > --
> > Dino Chiesa
> > Microsoft Developer Division
> > d i n o c h @ OmitThis . m i c r o s o f t . c o m
> >
> >
> > "Mark McConnell" <nbone> wrote in message
> > news:%23J2P$6OdEHA.1652@TK2MSFTNGP09.phx.gbl...
> > > Regarding deserializing XML into a custom object...
> > >
> > > I've been able to deserialize an XML doc into my custom object and
> > > everything works great. The problem I am encountering is when one of
> the
> > > XML elements contains a NULL and it maps to a variable of type Integer
> in
> > my
> > > custom object, the deserializer doesn't like this.
> > >
> > > For example, my custom object is declared like:
> > >
> > > Public Class Member
> > > Public Height As Integer
> > > End Class
> > >
> > >
> > > So, if I use the following XML element:
> > >
> > > <Height></Height>
> > > or
> > > <Height xsi:null='1' />
> > >
> > > the deserializer throws an exception (SystemInvalidOperationException:
> > > "There is an error in the XML document.") when trying to assign an
empty
> > > string (meant to represent NULL) to the Integer value. This makes
sense
> > and
> > > is expected behavior.
> > >
> > > If I completely remove the <Height> element from the XML in order to
> > > represent a NULL value, the deserializer works fine, but the custom
> > object's
> > > Integer variable (Height) is set to 0 (which isn't NULL). Shouldn't
the
> > > variable be set to Nothing? Should I not use the deserializer and
> > manually
> > > check each XML element value before assigning them to my custom
object's
> > > variables? What is the correct methodology for mapping SQL data that
> may
> > > contain NULLs into a custom object that uses Integers and String
> variable
> > > types? Can the deserializer use an XSD schema so that it knows that
an
> > > empty XML element indicates NULL for an Integer type?
> > >
> > > I'd appreciate any help you can offer.
> > >
> > > Thanks in advance!
> > > Mark
> > >
> > >
> >
> >
>
>