473,472 Members | 2,153 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Attributes failed to serialise correctly

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(Namespac e="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
Mar 29 '06 #1
2 1147
Have a look at this:

http://pluralsight.com/blogs/craig/a...7/27/1736.aspx

Dickster

Mar 29 '06 #2
Yep, that's the problem.

Cheers

"dickster" <gd***@kerrhenderson.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Have a look at this:

http://pluralsight.com/blogs/craig/a...7/27/1736.aspx

Dickster

Mar 30 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Info 3000 | last post by:
Hello, I'm beginner in XML. I have just a little question : I understand that I can write : <Book> <Title> A nice day </Title> <Author> James Nicepen </Author> </Book>
6
by: Martin | last post by:
Hi, I have a xml file like the one below <?xml version="1.0" encoding="utf-8"?><e1 xmlns:e1="http://tempuri.org/Source1.xsd" e1:att1="1" e1:att2="2" e1:rest="345"/> If I try to create a...
2
by: Zach Mortensen | last post by:
I can't seem to get dynamically-compiled JScript code to use C#-defined custom attributes. I have a simple attribute and a class defined in a C# assembly: namespace MyNamespace { public...
1
by: Bret Pehrson | last post by:
I've converted a non-trivial C++ library to managed, and get the following unhelpful linker error: Assignment.obj : error LNK2022: metadata operation failed (80131195) : Custom attributes are...
1
by: Tamas Demjen | last post by:
I started to experiment with VC++ 2005 Beta1. So far everything went fine, and already have a working project, but soon I realized that the compiler was ancient (not supporting half of the C++/CLI...
6
by: mangesh | last post by:
How to serialise objects in c++ , in java one has to implement serilisable interface . Regards mangesh.
11
by: gisleyt | last post by:
I need to escape e.g. & within an attribute, as in: <foo bar="+$"/> Since this is a regular expression and will not be validated as a normal xml file, i cannot use &amp; for &. CDATA does not seem...
4
by: Pedro Werneck | last post by:
Hi all I noticed something strange here while explaining decorators to someone. Not any real use code, but I think it's worth mentioning. When I access a class attribute, on a class with a...
2
by: Peter Møllerud | last post by:
I'm very new to Python, so consider this a silly newbie question... Anyway, I'm building a small application to generate a XML. Using document from minidom, I'm doing something like : from...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.