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

Serialize 2 nodes

Hi,

I have a class that I am trying to serialize. To simplify, I've changed the
names to Baseball, Teams and Players. Here is what the XML should look like:

<BaseBall>
<Teams>
<Team>
<Name />
<City />
</Team>
</Teams>
<Players>
<Player>
<FirstName />
<LastName />
</Player>
</Players>
</BaseBall>

I have a Team class, Player class, TeamCollection class, PlayerCollection
class and a Baseball class. I can add Teams to the TeamCollection and
serialize it to XML with out any problems. I can add Players to the
PlayerCollection and serialize it to XML with out any problems. When I try
to add a TeamCollection or PlayerCollection to the Baseball class I get an
error that says: "You must implement a default accessor on
Baseball.DataAccess+BaseballCollection because it inherits from ICollection."
Can anyone provide a simple example of the correct way to do this?

Nov 12 '05 #1
3 2144
Take a look at [0] where you'll find a detailed answer and some code
examples.

HTH,
Christoph Schittko
MVP XML
http://weblogs.asp.net/cschittko

-----Original Message-----
From: CLEAR-RCIC [mailto:CL*******@discussions.microsoft.com]
Posted At: Monday, January 24, 2005 7:59 AM
Posted To: microsoft.public.dotnet.xml
Conversation: Serialize 2 nodes
Subject: Serialize 2 nodes

Hi,

I have a class that I am trying to serialize. To simplify, I've changed the
names to Baseball, Teams and Players. Here is what the XML should look like:

<BaseBall>
<Teams>
<Team>
<Name />
<City />
</Team>
</Teams>
<Players>
<Player>
<FirstName />
<LastName />
</Player>
</Players>
</BaseBall>

I have a Team class, Player class, TeamCollection class, PlayerCollection class and a Baseball class. I can add Teams to the TeamCollection and
serialize it to XML with out any problems. I can add Players to the
PlayerCollection and serialize it to XML with out any problems. When I try
to add a TeamCollection or PlayerCollection to the Baseball class I get an error that says: "You must implement a default accessor on
Baseball.DataAccess+BaseballCollection because it inherits from
ICollection."
Can anyone provide a simple example of the correct way to do this?

Nov 12 '05 #2
J L
I am also interested. What does [0] mean?

John

On Tue, 25 Jan 2005 21:21:47 -0600, "Christoph Schittko [MVP]"
<IN**********@austin.rr.com> wrote:
Take a look at [0] where you'll find a detailed answer and some code
examples.

HTH,
Christoph Schittko
MVP XML
http://weblogs.asp.net/cschittko

-----Original Message-----
From: CLEAR-RCIC [mailto:CL*******@discussions.microsoft.com]
Posted At: Monday, January 24, 2005 7:59 AM
Posted To: microsoft.public.dotnet.xml
Conversation: Serialize 2 nodes
Subject: Serialize 2 nodes

Hi,

I have a class that I am trying to serialize. To simplify, I've

changed
the
names to Baseball, Teams and Players. Here is what the XML should

look
like:

<BaseBall>
<Teams>
<Team>
<Name />
<City />
</Team>
</Teams>
<Players>
<Player>
<FirstName />
<LastName />
</Player>
</Players>
</BaseBall>

I have a Team class, Player class, TeamCollection class,

PlayerCollection
class and a Baseball class. I can add Teams to the TeamCollection and
serialize it to XML with out any problems. I can add Players to the
PlayerCollection and serialize it to XML with out any problems. When

I
try
to add a TeamCollection or PlayerCollection to the Baseball class I

get an
error that says: "You must implement a default accessor on
Baseball.DataAccess+BaseballCollection because it inherits from
ICollection."
Can anyone provide a simple example of the correct way to do this?


Nov 12 '05 #3
It means I forgot to paste the link I referenced ;)

Should be:

[0]
http://www.topxml.com/xmlserializer/...on_classes.asp
-----Original Message-----
From: J L [mailto:jo**@marymonte.com]
Posted At: Wednesday, January 26, 2005 5:16 PM
Posted To: microsoft.public.dotnet.xml
Conversation: Serialize 2 nodes
Subject: Re: Serialize 2 nodes

I am also interested. What does [0] mean?

John

On Tue, 25 Jan 2005 21:21:47 -0600, "Christoph Schittko [MVP]"
<IN**********@austin.rr.com> wrote:
Take a look at [0] where you'll find a detailed answer and some code
examples.

HTH,
Christoph Schittko
MVP XML
http://weblogs.asp.net/cschittko

-----Original Message-----
From: CLEAR-RCIC [mailto:CL*******@discussions.microsoft.com]
Posted At: Monday, January 24, 2005 7:59 AM
Posted To: microsoft.public.dotnet.xml
Conversation: Serialize 2 nodes
Subject: Serialize 2 nodes

Hi,

I have a class that I am trying to serialize. To simplify, I've

changed
the
names to Baseball, Teams and Players. Here is what the XML should

look
like:

<BaseBall>
<Teams>
<Team>
<Name />
<City />
</Team>
</Teams>
<Players>
<Player>
<FirstName />
<LastName />
</Player>
</Players>
</BaseBall>

I have a Team class, Player class, TeamCollection class,

PlayerCollection
class and a Baseball class. I can add Teams to the TeamCollection and serialize it to XML with out any problems. I can add Players to the PlayerCollection and serialize it to XML with out any problems.
WhenI
try
to add a TeamCollection or PlayerCollection to the Baseball class I

get an
error that says: "You must implement a default accessor on
Baseball.DataAccess+BaseballCollection because it inherits from
ICollection."
Can anyone provide a simple example of the correct way to do this?


Nov 12 '05 #4

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

Similar topics

2
by: Jim Cobban | last post by:
I must be missing something. I am using org.apache.xml.serialize.XMLSerializer to save a DOM but I am not getting non-basic characters converted to UTF-8. I create Text nodes in the DOM by,...
3
by: Jim Cobban | last post by:
I must be missing something. I am using org.apache.xml.serialize.XMLSerializer to save a DOM but I am not getting non-basic characters converted to UTF-8. I create Text nodes in the DOM by,...
0
by: serge calderara | last post by:
Dear all, I am looking for a solution to serialize complete treeview nodes structure in a file or database or XML and deserialize it back when needed. this to save the current nodes...
14
by: vince | last post by:
Can I add (append) to an xml file that already contains a serialized object, and be able to deserialize to either or both objects from the same file...??? How is this done...?? thanks, vince
0
by: meh | last post by:
Still have not been able to convert this. More importently.....Is this sample going about it the right way??? tia meh Here is the vb code.........I keep looking at older vb.net projects to...
3
by: Toxick | last post by:
Hello experts, I'm a total C# noob with a total C# noob question. I've been Serializing in C++ (MFC) and writing data to std::fstreams for quite some time, so maybe I'm not understanding...
3
by: Eric | last post by:
I need to send an object between nodes on a network. Each node currently communicates fine with sending strings around but I can't figure out how to deserialize objects using the same basic...
17
by: Peter | last post by:
How would would you deserialize this example below? Imports System Imports System.Collections Imports System.IO Imports System.Xml.Serialization Public Class App1 Shared Sub Main()
4
by: teddysnips | last post by:
I would like to serialize a class to XML. The format of the XML is fixed (see below). It only needs to be serialized - it is read by another application. I know I can do it manually using...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
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...

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.