Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / March 2006

Tip: Looking for answers? Try searching our database.

Attributes failed to serialise correctly

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Glenn - 29 Mar 2006 09:33 GMT
Hi

Here's the scenario...

I have a web method to which a pass a customer ID.  The web method looks up
the customer and returns an XmlNode which I deserialise into a type.  I then
update information in the type and then serialise it back into an
XmlDocument ready for submission to another web method.  The problem is that
during serialisation, some, but not all attributes are not being created in
the document.

I've checked the originating document, the attributes appear as they should.

I've checked the type instance following deserialisation and the values are
populated correctly.

I've included the default namespace and XmlSerializerNamespaces, but that
doesn't seem to make a difference.

I even wired up the events on the XmlSerializer, but nothing was fired.

Here's one of the offending types...

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.namespace.com")]
public class AddressType {
/// <remarks/>
[System.Xml.Serialization.XmlAttributeAttribute()]
[System.ComponentModel.DefaultValueAttribute(4)]
public int CodeID = 4;

/// <remarks/>
[System.Xml.Serialization.XmlTextAttribute()]
public string Value;
}

The really strange thing is another type which is exactly the same bar the
name and DefaultValueAttribute serialises just fine.

Any ideas?

Thanks

Glenn
VS2005 C# XP
dickster - 29 Mar 2006 11:23 GMT
Have a look at this:

http://pluralsight.com/blogs/craig/archive/2004/07/27/1736.aspx

Dickster
Glenn - 30 Mar 2006 11:21 GMT
Yep, that's the problem.

Cheers

> Have a look at this:
>
> http://pluralsight.com/blogs/craig/archive/2004/07/27/1736.aspx
>
> Dickster

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.