473,320 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Stupid (I hope) XML questions

Ok,
I have a project that is destined for continual growth and development
over the next few years (benign scope creep). The object model is
relatively generic at the moment, but will be extended considerably
over time, mostly using inheritance.
Each document will have a single element at the root and it will
contain a collection of objects that are based off of a finite number
of base classes. However, these objects may have numerous child
classes and I can not guarantee that the child classes won't be
containers themselves. References will be allowed between objects of
different base types, but not between objects of the same base type.
Here are my questions:
1) How should I serialize these objects to make sure that my
serialization mechanism continues to work well over time? Should I
implement ISerializable?
2) How hard is it to implement document versioning?
3) How would you suggest creating and maintaining a schema so that I
can validate the contents of the documents.
4) Some of the child classes being serialized may not be present when
I attempt to deserialize - I'd like to just load the base class when
this happens. Is this possible?

Thanks in advance for your help,
William Gant
wg***@transcenderNOSPAM.com
Nov 11 '05 #1
3 1765
1) Are you serializing via the XmlSerializer, then ISerializable is not in
the picture. If you serialize via the SoapFormatter/BinaryFormatter and you
expect that you need to handle versioning it is best to implement
ISerializable.

XmlSerialization is a lot more forgiving than runtime serialization, but
doesn't provide as many hooks to customize processing either.

2) What are you trying to achieve? How can one identify a new version? Is a
new version identified by a new XML namespace?

3) Take a look at some of the XML tools out there. The schema editor in
VS.NET is bareable for smaller schemas, but you may want more
user-friendlyness of you are working with larger schemas.

4) I am not sure, what you mean. The XmlSerializer does not support lazy
loading of documents, but it can handle optional elements, i.e. it doesn't
require a full document to deserialize it.

--
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor

"William Gant" <wg***@transcender.com> wrote in message
news:36**************************@posting.google.c om...
Ok,
I have a project that is destined for continual growth and development
over the next few years (benign scope creep). The object model is
relatively generic at the moment, but will be extended considerably
over time, mostly using inheritance.
Each document will have a single element at the root and it will
contain a collection of objects that are based off of a finite number
of base classes. However, these objects may have numerous child
classes and I can not guarantee that the child classes won't be
containers themselves. References will be allowed between objects of
different base types, but not between objects of the same base type.
Here are my questions:
1) How should I serialize these objects to make sure that my
serialization mechanism continues to work well over time? Should I
implement ISerializable?
2) How hard is it to implement document versioning?
3) How would you suggest creating and maintaining a schema so that I
can validate the contents of the documents.
4) Some of the child classes being serialized may not be present when
I attempt to deserialize - I'd like to just load the base class when
this happens. Is this possible?

Thanks in advance for your help,
William Gant
wg***@transcenderNOSPAM.com

Nov 11 '05 #2
1) I actually haven't written the serialization code yet. I probably
need to use the more flexible method. I'm assuming that ISerializable
and a formatter would be best. How do I handle versioning in this
case?
2) I haven't really decided how to handle a new version. What options
do I have?
3) Is there anything special I need to do to the schema to allow for
versioning?
4) It may be that I just have to give an error message when the user
doesn't have the object libraries required to load a specific object
on deserialization. I think it would be nice to be able to load the
base class for the object, but after considering it, doing so will
offer no real benefit since the object can not be correctly serialized
again later on.
"Christoph Schittko [MVP]" <ch********************@austin.rr.com> wrote in message news:<#a*************@TK2MSFTNGP11.phx.gbl>...
1) Are you serializing via the XmlSerializer, then ISerializable is not in
the picture. If you serialize via the SoapFormatter/BinaryFormatter and you
expect that you need to handle versioning it is best to implement
ISerializable.

XmlSerialization is a lot more forgiving than runtime serialization, but
doesn't provide as many hooks to customize processing either.

2) What are you trying to achieve? How can one identify a new version? Is a
new version identified by a new XML namespace?

3) Take a look at some of the XML tools out there. The schema editor in
VS.NET is bareable for smaller schemas, but you may want more
user-friendlyness of you are working with larger schemas.

4) I am not sure, what you mean. The XmlSerializer does not support lazy
loading of documents, but it can handle optional elements, i.e. it doesn't
require a full document to deserialize it.

--
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor

"William Gant" <wg***@transcender.com> wrote in message
news:36**************************@posting.google.c om...
Ok,
I have a project that is destined for continual growth and development
over the next few years (benign scope creep). The object model is
relatively generic at the moment, but will be extended considerably
over time, mostly using inheritance.
Each document will have a single element at the root and it will
contain a collection of objects that are based off of a finite number
of base classes. However, these objects may have numerous child
classes and I can not guarantee that the child classes won't be
containers themselves. References will be allowed between objects of
different base types, but not between objects of the same base type.
Here are my questions:
1) How should I serialize these objects to make sure that my
serialization mechanism continues to work well over time? Should I
implement ISerializable?
2) How hard is it to implement document versioning?
3) How would you suggest creating and maintaining a schema so that I
can validate the contents of the documents.
4) Some of the child classes being serialized may not be present when
I attempt to deserialize - I'd like to just load the base class when
this happens. Is this possible?

Thanks in advance for your help,
William Gant
wg***@transcenderNOSPAM.com

Nov 11 '05 #3
1) If you need flexibility then you should definitely go with the
XmlSerializer

2) What constitutes a new version? What are the parameters of your project?
Is a new version a doc format with additional children? New top level
elements? Do they need to be backwards compatible? Should they NOT be
backwards compatible?

3) that depends if you ever need to be able to validate new documents
against old schemas. If you do, then the schemas need to indicate where to
expect extensions through the any and anyAttribute constructs.

4) The XmlSerializer will not deserialize any content that it does not
recognize and it only recognizes content that matches the types that were
passed in to the constructor of the particular XmlSerializer instance.
Unless you are planning to do some fancy stuff with reflection you will
always need the deserialization libraries present when your program is
executing. The serializer will throw an exception when it does not recognize
the root element in the document you are serializing.You can catch that
exception and report it in the way your application expects it. You can also
register delegates (callbacks) to receive notifications about unrecognized
XML content. You can use this mechanism to report your own errors as well.

Did this help?
--
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor

"William Gant" <wg***@transcender.com> wrote in message
news:36**************************@posting.google.c om...
1) I actually haven't written the serialization code yet. I probably
need to use the more flexible method. I'm assuming that ISerializable
and a formatter would be best. How do I handle versioning in this
case?
2) I haven't really decided how to handle a new version. What options
do I have?
3) Is there anything special I need to do to the schema to allow for
versioning?
4) It may be that I just have to give an error message when the user
doesn't have the object libraries required to load a specific object
on deserialization. I think it would be nice to be able to load the
base class for the object, but after considering it, doing so will
offer no real benefit since the object can not be correctly serialized
again later on.
"Christoph Schittko [MVP]" <ch********************@austin.rr.com> wrote in

message news:<#a*************@TK2MSFTNGP11.phx.gbl>...
1) Are you serializing via the XmlSerializer, then ISerializable is not in the picture. If you serialize via the SoapFormatter/BinaryFormatter and you expect that you need to handle versioning it is best to implement
ISerializable.

XmlSerialization is a lot more forgiving than runtime serialization, but
doesn't provide as many hooks to customize processing either.

2) What are you trying to achieve? How can one identify a new version? Is a new version identified by a new XML namespace?

3) Take a look at some of the XML tools out there. The schema editor in
VS.NET is bareable for smaller schemas, but you may want more
user-friendlyness of you are working with larger schemas.

4) I am not sure, what you mean. The XmlSerializer does not support lazy
loading of documents, but it can handle optional elements, i.e. it doesn't require a full document to deserialize it.

--
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor

"William Gant" <wg***@transcender.com> wrote in message
news:36**************************@posting.google.c om...
Ok,
I have a project that is destined for continual growth and development
over the next few years (benign scope creep). The object model is
relatively generic at the moment, but will be extended considerably
over time, mostly using inheritance.
Each document will have a single element at the root and it will
contain a collection of objects that are based off of a finite number
of base classes. However, these objects may have numerous child
classes and I can not guarantee that the child classes won't be
containers themselves. References will be allowed between objects of
different base types, but not between objects of the same base type.
Here are my questions:
1) How should I serialize these objects to make sure that my
serialization mechanism continues to work well over time? Should I
implement ISerializable?
2) How hard is it to implement document versioning?
3) How would you suggest creating and maintaining a schema so that I
can validate the contents of the documents.
4) Some of the child classes being serialized may not be present when
I attempt to deserialize - I'd like to just load the base class when
this happens. Is this possible?

Thanks in advance for your help,
William Gant
wg***@transcenderNOSPAM.com

Nov 11 '05 #4

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

Similar topics

3
by: Jan Waga | last post by:
Hello, I've written and installed windows service in C#. I have two questions: 1) File.Open("lock", FileMode.OpenOrCreate, FileAccess.Read, FileShare.None) does not create the file even if...
36
by: Hoopster | last post by:
Hello, I know nothing about C++ but want to get started. Is there any good free C++ program that I can try to see if I like programming? I also need a good free compiler. I don't want to...
12
by: prashna | last post by:
Hi Guru's, Here are my questions... 1)Why does c allows an extra "," in array intialiser?Is there any advantage of this? ex: int arr={1,2,3,4,5,}; ^^Compiler does not give error for this! ...
4
by: Uchiha Jax | last post by:
Hello everyone, I am a plenty silly person who is trying to learn .NET remoting through trial and error (all articles I read are going over my head at the moment (mostly) so I thought i'd give...
3
by: bredal Jensen | last post by:
I'm currently downloading the Microsoft "Visual web developer 2005 Express" and i have a few questions in case someone could have insider informations about this. I have just attended a seminar...
6
by: Adam Smith | last post by:
I have posted this and similar questions repeatedly and can't even raise a single response. I am being led to believe that this then 'Must be a stupid question' although people say that there is no...
1
by: M.N.A.Smadi | last post by:
hi guys; sorry for sending a perl question here, but python guy "HAD TO" look at perl code; how can i split a string that contains white spaces and '_' any clue? thanks
4
by: Steve | last post by:
I have read a couple articles online, read my Jesse Liberty book but I am still confused as to just what the best practices are for using exceptions. I keep changing how I'm working with them and...
2
by: ComputerTeacher | last post by:
Hi, I teach Access to high school sophmores and one topic our textbook does not cover is how to open a database without going through the steps of opening Access. Can I have an icon on my desktop...
22
by: Guru Jois | last post by:
Hai all, I have some question. Please answer. 1. What is walking pointer? 2. What is difference between procedure and subroutine? 3. What is template of main in C? 4. What is padding of...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.