![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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 |
| | #2 (permalink) |
| 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 |
| | #3 (permalink) |
| 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 > > > |
| | #4 (permalink) |
| 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 |
| | #5 (permalink) |
| 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 |