473,499 Members | 1,955 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XmlIgnore an inherited attribute

Hi,

I have a number of classes that inherit from another class which
contains an attribure called "Url". I serialise my objects to an xml
file, but I would like to hide the "url" attribute for one of my
inherited classes. I can place the XmlIgnore in the base class, but
this will hide the attribute for all derived class. What should I do?

Thanks,

Barry.

Oct 18 '07 #1
2 3223
You could try adding a "bool ShouldSerializeUrl()" method; this is a
pattern (like "event EventHandler UrlChanged") recognised by various
parts of the core framework.

If you have inheritance, though, you may need to do this at the base
class (return true), and then override in the subclass (return false).

Marc
Oct 18 '07 #2
You could try adding a "bool ShouldSerializeUrl()" method; this is a
pattern (like "event EventHandler UrlChanged") recognised by various
parts of the core framework.

If you have inheritance, though, you may need to do this at the base
class (return true), and then override in the subclass (return false).

Marc
Oct 18 '07 #3

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

Similar topics

9
3566
by: Alex | last post by:
I have a serious problem and I hope there is some solution. It is easier to illustrate with a simple code: >>> class Parent(object): __slots__= def __init__(self, a, b): self.A=a; self.B=b...
2
11272
by: Robert W. | last post by:
A while back I posted this:...
2
1248
by: feng | last post by:
Hi, I have a class, say class A, that has <Serializable()> attribute applied to it. Now if I create a class B that inherits from A, does B automaticly inherits this attribute also? or do I have...
1
4350
by: nickdu | last post by:
By the way, I also posted this on DotNet Framework General. I'm trying to serialize, via the XmlSerializer, an object which is derived from System.Windows.Forms.Control. It throws an exception...
10
5082
by: John M. Gabriele | last post by:
The following short program fails: ----------------------- code ------------------------ #!/usr/bin/python class Parent( object ): def __init__( self ): self.x = 9 print "Inside...
1
2644
by: bnreddynet | last post by:
I have a base class which contains one public virtual property. I derived this class and overrided that property with xmlignore tag is added. when i try to xmlserialize, it is not ignored by...
1
3713
by: Undergrid | last post by:
I have a pretty complex data structure which I want to serialize to and from XML, I have tried the .net 2.0 serialization engine and proved that it will work for my structure. However by...
3
1841
by: Dan Holmes | last post by:
Say i have: public class A { } public class B : A {
0
1071
by: parag2008 | last post by:
I have created a web service in java. This web service is invoked from a .net client, the proxies of which are generated by the Visual Studio. When I create the proxies some of the properties in a...
0
7007
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
7174
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7220
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
6894
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
4919
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
4600
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
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.