473,383 Members | 1,803 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,383 software developers and data experts.

Deserializing an Object from XML Using Schema

Hi,

I need to deserialize an existing object (not generate its code) from a
serialized XML file.
The only information I have about how the deserialization method is an input
XML schema (which can vary) associated with the XML file containing the
serialized object data. Therefore pre-defining it in code using xml
attributes on the serialized class narrows it to only one serialization
method and won't do.
How can I use the schema to deserialize the object?

Thanks,
Sigalit.
Oct 18 '06 #1
5 2594
"Veilchen" <Ve******@discussions.microsoft.comwrote in message
news:A7**********************************@microsof t.com...
Hi,

I need to deserialize an existing object (not generate its code) from a
serialized XML file.
The only information I have about how the deserialization method is an
input
XML schema (which can vary) associated with the XML file containing the
serialized object data. Therefore pre-defining it in code using xml
attributes on the serialized class narrows it to only one serialization
method and won't do.
How can I use the schema to deserialize the object?

How do you reference the object in your .NET code?

I don't understand what you mean when you say that the schema can vary. Do
you mean that the schema for a given type can vary, or that there are
several types you're dealing with?

John
Oct 18 '06 #2
I meant that the schema can vary.
Oct 18 '06 #3
"Veilchen" <Ve******@discussions.microsoft.comwrote in message
news:6B**********************************@microsof t.com...
>I meant that the schema can vary.
Yes, but under what circumstances?

I really don't understand what you're asking.

John
Oct 18 '06 #4
I meant that I am looking for way to deserialize an object from XML using
only a schema which will contain the information about how to deserialize,
without depending on any deserialization information defined in my object.

"John Saunders" wrote:
"Veilchen" <Ve******@discussions.microsoft.comwrote in message
news:6B**********************************@microsof t.com...
I meant that the schema can vary.

Yes, but under what circumstances?

I really don't understand what you're asking.

John
Oct 19 '06 #5
"Veilchen" <Ve******@discussions.microsoft.comwrote in message
news:B4**********************************@microsof t.com...
>I meant that I am looking for way to deserialize an object from XML using
only a schema which will contain the information about how to
deserialize,
without depending on any deserialization information defined in my object.
I guess I'm still being dense here.

You want the schema to be able to change without changing your object? How
will your object hold the changed data? How will it refer to it?

Maybe you should just use XML directly and forget about using strongly-typed
objects. Such objects want to know their shape when they're constructed.

Alternatively, you could use a code generator like XSD.EXE or CodeSmith to
create objects from the schema, then deserialize into the objects. This
might work for you.

Otherwise, I'm not understanding how the schema will change and the object
not change.

John
Oct 20 '06 #6

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

Similar topics

0
by: alex | last post by:
I am trying to use XmlSerializer to serialize the XML string into an object. I used the XML schema definition to generate the code for the corresponding class (using xsd.exe). The top level class...
3
by: Mark McConnell | last post by:
Regarding deserializing XML into a custom object... I've been able to deserialize an XML doc into my custom object and everything works great. The problem I am encountering is when one of the...
0
by: Peter Theill | last post by:
Hi, I'm having an issue with deserializing some xml using a proxy class generated by "xsd.exe". My proxy class contains this class definition: public class IqProfileType {
0
by: Mark Rance | last post by:
Using the example XML file below, I created via the xsd tool, a class so as to be able to serialize/deserialize the data. The generated class, as per usual, has an Items collection of booksBook...
7
by: farseer | last post by:
Hi, i am getting an error when trying to deserialize and xml. the error is shown below. i get this error regardless if i try to desearialize in C# or VB. the XML itself does infact contain a...
9
by: PeterWellington | last post by:
I have a column in a data table that stores enum values and assigns a default value: Dim dc As New DataColumn("TestEnumField", GetType(DayOfWeek)) dc.DefaultValue = DayOfWeek.Thursday When I...
0
by: Sivajee Akula | last post by:
Hello All, I am trying to consume a .NET Service from Adobe LiveCycle Workflow. The service deals with complex objects. I am getting the following exception at the time of invocation of the...
0
by: =?Utf-8?B?dm96ZWxkcg==?= | last post by:
I'm having an issue in deserializing an object from XML. I generated my XML schema from my .NET dll using xsd.exe. I've used that schema in another application. That application spits out XML based...
0
by: theonlydavewilliams | last post by:
Hi there I'm hoping there's an easy answer to a (hopefully) not too long-winded issue... I'm building a C# web client using a proxy wsdl.exe'd from a wsdl file and six schemas, each in a different...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.