Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Indigo

Vista - DataContractSerializer "Expecting element" problem

 
 
Old 11-15-2006   #1 (permalink)
Xeron


 
 

DataContractSerializer "Expecting element" problem

Hello !

I have just passed to the RTM version of winfx and I don't understand why
the DataContractSerializer doesn't work any more.

I want to serialize an object with a xml stream which no contain all the
properties of the object. With the winfx beta 2, it work fine, but now I
optain the error :

"Error in line 3 position 4. 'Element' 'CommonName' from namespace
'http://schemas.datacontract.org/2004/07/Site' is not expected. Expecting
element '_includedProperties'."

I tried to use serializer like this :

DataContractSerializer __serializer = new
DataContractSerializer(typeof(Site[]), null, Int32.MaxValue, true, true,
null);

On msdn (http://msdn2.microsoft.com/en-us/library/aa344262.aspx) we can read
: "parameters to ignore unexpected data" but it seem not work ...

I tried to motify the DataMember to "NotRequired" like this :

[DataMember(IsRequired=false)]
private IList<string> _includedProperties = new List<string>();

But no changes ...

Can somebody help me ? thanks
Xeron

My System SpecsSystem Spec
Old 11-16-2006   #2 (permalink)
Arkady Frenkel


 
 

Re: DataContractSerializer "Expecting element" problem

Ask additionally that on
http://forums.microsoft.com/MSDN/Sho...D=118&SiteID=1
Arkady

"Xeron" <Xeron@discussions.microsoft.com> wrote in message
news:55FDE637-ED15-42FC-8545-EB17A9268902@microsoft.com...
> Hello !
>
> I have just passed to the RTM version of winfx and I don't understand why
> the DataContractSerializer doesn't work any more.
>
> I want to serialize an object with a xml stream which no contain all the
> properties of the object. With the winfx beta 2, it work fine, but now I
> optain the error :
>
> "Error in line 3 position 4. 'Element' 'CommonName' from namespace
> 'http://schemas.datacontract.org/2004/07/Site' is not expected. Expecting
> element '_includedProperties'."
>
> I tried to use serializer like this :
>
> DataContractSerializer __serializer = new
> DataContractSerializer(typeof(Site[]), null, Int32.MaxValue, true, true,
> null);
>
> On msdn (http://msdn2.microsoft.com/en-us/library/aa344262.aspx) we can
> read
> : "parameters to ignore unexpected data" but it seem not work ...
>
> I tried to motify the DataMember to "NotRequired" like this :
>
> [DataMember(IsRequired=false)]
> private IList<string> _includedProperties = new List<string>();
>
> But no changes ...
>
> Can somebody help me ? thanks
> Xeron



My System SpecsSystem Spec
Old 11-16-2006   #3 (permalink)
Xeron


 
 

Re: DataContractSerializer "Expecting element" problem

Done, thx

"Arkady Frenkel" wrote:

> Ask additionally that on
> http://forums.microsoft.com/MSDN/Sho...D=118&SiteID=1
> Arkady
>
> "Xeron" <Xeron@discussions.microsoft.com> wrote in message
> news:55FDE637-ED15-42FC-8545-EB17A9268902@microsoft.com...
> > Hello !
> >
> > I have just passed to the RTM version of winfx and I don't understand why
> > the DataContractSerializer doesn't work any more.
> >
> > I want to serialize an object with a xml stream which no contain all the
> > properties of the object. With the winfx beta 2, it work fine, but now I
> > optain the error :
> >
> > "Error in line 3 position 4. 'Element' 'CommonName' from namespace
> > 'http://schemas.datacontract.org/2004/07/Site' is not expected. Expecting
> > element '_includedProperties'."
> >
> > I tried to use serializer like this :
> >
> > DataContractSerializer __serializer = new
> > DataContractSerializer(typeof(Site[]), null, Int32.MaxValue, true, true,
> > null);
> >
> > On msdn (http://msdn2.microsoft.com/en-us/library/aa344262.aspx) we can
> > read
> > : "parameters to ignore unexpected data" but it seem not work ...
> >
> > I tried to motify the DataMember to "NotRequired" like this :
> >
> > [DataMember(IsRequired=false)]
> > private IList<string> _includedProperties = new List<string>();
> >
> > But no changes ...
> >
> > Can somebody help me ? thanks
> > Xeron

>
>
>

My System SpecsSystem Spec
Old 11-16-2006   #4 (permalink)
Xeron


 
 

Re: DataContractSerializer "Expecting element" problem

Done, thx

"Arkady Frenkel" wrote:

> Ask additionally that on
> http://forums.microsoft.com/MSDN/Sho...D=118&SiteID=1
> Arkady


My System SpecsSystem Spec
Old 12-12-2006   #5 (permalink)
Sara Wong - MSFT


 
 

RE: DataContractSerializer "Expecting element" problem

Hi Xeron,

Can you share a repro so we can look into it further?

Thanks,
Sara

"Xeron" wrote:

> Hello !
>
> I have just passed to the RTM version of winfx and I don't understand why
> the DataContractSerializer doesn't work any more.
>
> I want to serialize an object with a xml stream which no contain all the
> properties of the object. With the winfx beta 2, it work fine, but now I
> optain the error :
>
> "Error in line 3 position 4. 'Element' 'CommonName' from namespace
> 'http://schemas.datacontract.org/2004/07/Site' is not expected. Expecting
> element '_includedProperties'."
>
> I tried to use serializer like this :
>
> DataContractSerializer __serializer = new
> DataContractSerializer(typeof(Site[]), null, Int32.MaxValue, true, true,
> null);
>
> On msdn (http://msdn2.microsoft.com/en-us/library/aa344262.aspx) we can read
> : "parameters to ignore unexpected data" but it seem not work ...
>
> I tried to motify the DataMember to "NotRequired" like this :
>
> [DataMember(IsRequired=false)]
> private IList<string> _includedProperties = new List<string>();
>
> But no changes ...
>
> Can somebody help me ? thanks
> Xeron

My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Anno 1404 "save/load" problem and using "runas.exe" Gaming
New Problem - "From" Address format in "Microsoft Communities" Live Mail


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46