Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Indigo

DataContractSerializer "Expecting element" problem

 
 
Thread Tools Display Modes
Old 11-15-2006   #1 (permalink)
Xeron
Guest


 

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
Old 11-16-2006   #2 (permalink)
Arkady Frenkel
Guest


 

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



Old 11-16-2006   #3 (permalink)
Xeron
Guest


 

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

>
>
>

Old 11-16-2006   #4 (permalink)
Xeron
Guest


 

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


Old 12-12-2006   #5 (permalink)
Sara Wong - MSFT
Guest


 

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

 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
New Problem - "From" Address format in "Microsoft Communities" John Saunders [MVP] Live Mail 5 04-03-2008 07:35 AM
Vista not wotking with "My Computer" or "Control Panel", "Screen Saver" Platebanger Vista General 6 02-05-2008 08:54 AM
Accessing an Array element(i) from a XAML "binding path" iterationx Avalon 1 03-23-2007 11:17 AM
How to force KeyboardNavigation's "current element" ??? Marcus Avalon 0 04-28-2006 12:18 PM








Vistax64.com 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 2005-2008

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 47 48 49 50