473,626 Members | 3,289 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 3231
You could try adding a "bool ShouldSerialize Url()" 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 ShouldSerialize Url()" 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
3588
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 def __getstate__(self): return self.A, self.B def __setstate__(self, tup):
2
11275
by: Robert W. | last post by:
A while back I posted this: http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.dotnet.languages.csharp&tid=129eaabb-a6d2-4fc4-8ebc-85878d2303b4&cat=en-us-msdn-visualtools-vcsharp&lang=en&cr=US&sloc=en-us&m=1&p=1 Well, I never did get the built-in XML Serialization method working so I wrote my own. I use Reflection to work its way through my complex object and "manually" write out what I need to do. It works great. ...
2
1260
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 to apply <Serializable()> to B, if I want B to be serializable? Thanks
1
4357
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 complaining about not being able to serialize the Site property. I expected problems and my plan was to work through them one at a time supplying an XmlIgnore attribute for each of the properties it had problems with. However, for some reason...
10
5098
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 Parent.__init__()"
1
2649
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 xmlserializer. how can i achieve this.
1
3723
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 default the serialization engine outputs every property it comes across and I was wondering if it would be possible to get it to behave as if everything had the XmlIgnore attribute attached unless another xml serialization attribute with specified? ...
3
1850
by: Dan Holmes | last post by:
Say i have: public class A { } public class B : A {
0
1079
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 generated proxy metadata are marked as which should not be the case. Because of these properties marked XmlIgnore , they are not serialised, and hence passed on as null in the web service request. I dont want these properties marked XmlIgnore....
0
8713
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8370
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8514
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7206
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6126
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5579
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4208
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2632
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1516
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.