472,958 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

inheritance vs xml

Hello!

I have inheritance between classes which are the result of xml
serialization.
My question is how can I insure in serializaion stage that the hierarchy
in xml is according to inheritance hierarchy in classes?

Thank you very much!

*** Sent via Developersdex http://www.developersdex.com ***
Jun 27 '08 #1
5 1018
On May 12, 9:54*am, csharpula csharp <csharp...@yahoo.comwrote:
Hello!

I have inheritance between classes which are the result of xml
serialization.
My question is how can I insure in serializaion stage that the hierarchy
in xml is according to inheritance hierarchy in classes?

Thank you very much!

*** Sent via Developersdexhttp://www.developersdex.com***
Hi,

Can you give more details? it;s not very clear where is your problem.
Jun 27 '08 #2
Hi,

E.g. try to deserialize the class tree, then validate the result.

Regards, Alex
[TechBlog] http://devkids.blogspot.com

ccHello!
cc>
ccI have inheritance between classes which are the result of xml
ccserialization.
ccMy question is how can I insure in serializaion stage that the
cchierarchy
ccin xml is according to inheritance hierarchy in classes?
ccThank you very much!
cc>
cc*** Sent via Developersdex http://www.developersdex.com ***
cc>
Jun 27 '08 #3

My question is : if I have ClassA:ClassB and in xml Class B element has
a memeber which is not of type A or B - is there an error in loading
this xml?
*** Sent via Developersdex http://www.developersdex.com ***
Jun 27 '08 #4
My question is : if I have ClassA:ClassB and in xml Class B element has
a memeber which is not of type A or B - is there an error in loading
this xml?
See XmlAnyAttributeAttribute / XmlAnyElementAttribute:

http://msdn.microsoft.com/en-us/libr...attribute.aspx
http://msdn.microsoft.com/en-us/libr...attribute.aspx

Marc
Jun 27 '08 #5
Also - it suggests no error is raised by default, but you can detect
unknown nodes and do what you want:

http://msdn.microsoft.com/en-us/libr...knownnode.aspx

"By default, after calling the Deserialize method, the XmlSerializer
ignores XML nodes of unknown types. However, you can use this event to
handle such node types."

http://msdn.microsoft.com/en-us/libr...attribute.aspx

"By default, after calling the Deserialize method, the XmlSerializer
ignores XML attributes of unknown types. However, you can use this event
to handle such node types."

Marc
Jun 27 '08 #6

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

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
2
by: Graham Banks | last post by:
Does using multiple inheritance introduce any more performance overhead than single inheritance?
4
by: JKop | last post by:
I'm starting to think that whenever you derive one class from another, that you should use virtual inheritance *all* the time, unless you have an explicit reason not to. I'm even thinking that...
5
by: Morgan Cheng | last post by:
It seems no pattern defined by GoF takes advantage of multiple inheritance. I am wondering if there is a situation where multiple inheritance is a necessary solution. When coding in C++, should...
10
by: davidrubin | last post by:
Structural inheritance (inheriting implementation) is equivalent to composition in that a particular method must either call 'Base::foo' or invoke 'base.foo'. Apparantly, The Literature tells us to...
14
by: Steve Jorgensen | last post by:
Recently, I tried and did a poor job explaining an idea I've had for handling a particular case of implementation inheritance that would be easy and obvious in a fully OOP language, but is not at...
22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
45
by: Ben Blank | last post by:
I'm writing a family of classes which all inherit most of their methods and code (including constructors) from a single base class. When attempting to instance one of the derived classes using...
60
by: Shawnk | last post by:
Some Sr. colleges and I have had an on going discussion relative to when and if C# will ever support 'true' multiple inheritance. Relevant to this, I wanted to query the C# community (the...
6
by: Bart Simpson | last post by:
I remember reading on parashift recently, that "Composition is for code reuse, inheritance is for flexibility" see (http://www.parashift.com/c++-faq-lite/smalltalk.html#faq-30.4) This confused...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.