Array Serialization

From: S (stephen_at_acsalaska.com)
Date: 04/29/04


Date: Thu, 29 Apr 2004 02:00:17 -0800

Hi there,
Here's a question for ya:
I'm serializing something that looks like this:
[XmlRoot(ElementName="Widget")]
Class Widget --> My base class
    [XmlArray(ElementName="TextGroups")]
    [XmlArrayItem(ElementName="TextGroup",Type=typeof(ClassTextGroup))]
    public ArrayList TextGroups --> An arraylist of collections
(TextGroup Collections)
        TextGroup --> A custom collection
(collectionbase) of Text objects
            [XmlRoot(ElementName="Text")]
            Text --> The text object

Problem is, the xml comes out like this:
<Widget>
    <TextGroups>
        <ArrayofText>
            <Text>

I would have thought my XmlArrayItem attribute on the ArrayList would have
taken care of this "Arrayof..." business, but is it running into a problem
because it's an array of, essentially, arrays? Any ideas on how I could fix
this without changing the structure of my class??

Thanks,
S



Relevant Pages

  • Re: Array Serialization
    ... Your code is serializing N elements of the array, ... why you get a stream with N xml documents, ...
    (microsoft.public.dotnet.xml)
  • Array Serialization
    ... I'm serializing something that looks like this: ... (TextGroup Collections) ... the xml comes out like this: ... because it's an array of, essentially, arrays? ...
    (microsoft.public.dotnet.languages.csharp)
  • Array Serialization
    ... I'm serializing something that looks like this: ... (TextGroup Collections) ... the xml comes out like this: ... because it's an array of, essentially, arrays? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Serialization with XmlSerializer: how to set the XML root node to something different from <
    ... > when serializing an array of elements of a class Classname using ... > I'd like to be able to set the XML root node to something different from ...
    (microsoft.public.dotnet.xml)