473,320 Members | 1,572 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.

deserialize IEnumerable with anyType tags

Hi,

I have a data structure which is serialzied into an xml like this:

<?xml version="1.0" encoding="utf-8"?>
<Storage xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Frames>
<Frame Index="0">
<Tags>
<anyType xsi:type="ProjectInfo">
<ProjectType>MediaTags.Projects.FACS</ProjectType>
<MediaFile>C:\develop\JustForFun\Dyade07divx.avi </MediaFile>
</anyType>
</Tags>
</Frame>
<Frame Index="98">
<Tags>
<anyType xsi:type="FacsTag">
<id>7</id>
</anyType>
</Tags>
</Frame>
</Frames>
</Storage>

If I try to deserialize this structure, everything works fine up to the
level of Tags. Tags is a class, which implements IEnumerable and the
required Add(object o) method.

But Add is not called with instances of ProjectInfo and FacsTag. It's
called with arrays of objects. The first entry is the xsi:type Attribute
followed by the child nodes of the anyType tag.

Is that correct behavior? I would have expected that the ProjectInfo and
FacsTag objects are deserialzied too. Is there something I have to do to
enable this functionality?

regards,
Achim
Nov 12 '05 #1
1 1826
Achim Domma (SyynX Solutions GmbH) wrote:
I have a data structure which is serialzied into an xml like this: [...] But Add is not called with instances of ProjectInfo and FacsTag. It's
called with arrays of objects. The first entry is the xsi:type Attribute
followed by the child nodes of the anyType tag.


Just for the records, answering my own question:

The relevant data types were not known to the deserializer. I wondered
on how to tell the deserialzier about them, because you can pass types
to the Serialize function, but not to Deserialze. The solution is to
pass the types to the ctor of the serialzizer.

The following article was very helpfull in figuring out how
serializing/deserializing works:

http://msdn.microsoft.com/library/de...trblshtxsd.asp

regards,
Achim
Nov 12 '05 #2

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

Similar topics

1
by: Igor Akkerman | last post by:
Hi, why does <xs:element name="any" type="xs:anyType" /> not validate <any><foo><bar>blah</bar></foo></any> ?
3
by: Razvan | last post by:
Hi After playing with XML Spy I saw that in DTDs the element of type "any" could contain text and any element that was declared in the DTD. In XML Schema an element of type anyType can...
0
by: maersa | last post by:
Hi all, i'm serializing an arraylist like the following with an "Role" object as it's item. ----------------------------------------------------- ---- ArrayList ar = new ArrayList();...
1
by: Sebastian Mark | last post by:
Did anyone got error like that? When I'm trying to Update WebReference in my project this is an error I'm getting "Custom tool error: Failed to generate dataset. Undefined data type:...
0
by: lonnie.lewis | last post by:
Hi all, I'm a consumer of a web service which is defining an output parameter as an "xsd:anyType": <message name="MyTransaction.IsWebServicesDataValid"> ... <part name="varDisplayMessage"...
1
by: JonBeatty | last post by:
I am trying to serialize a class derived from ArrayList called JobQueue that contains an array of objects of the class Job. Using XmlSerializer I can get this to serialize successfully, but I am...
2
by: Joe | last post by:
Hi I have a Generics List in a PropertyGrid I am able to Serialize it to XML but when I try to deserialize back to the class of the PropertyGrid The Constructor doesn't seem to fire to reload...
11
by: wpmccormick | last post by:
I've a complex problem: I'm deserializing a very long string of XML into a very large object foo: <foo> ....... <bar>sometimes a simple string is here</bar> ....... </foo>
3
by: Rotsey | last post by:
Hi, I am ceating a xml file from SQL data using VS2003. I want to then use xslt to transform xml to my web page. But the xml file when after serialisation has some nodes like this <anyType...
1
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)...
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...
1
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.