[Mono-list] Probleme with XML

Julien Sobrier julien at sobrier.net
Sat Aug 19 01:48:15 EDT 2006


Hello,
I have an XML that looks like this (simplified):
<schemafile>
    <schemalist module="xxxx">
        <schema>
            ...
        </schema>
        <schema>
            ....
        <schema>
    </schemalist>
</schemafile>

I have the corresponding C# objects (simplified also):

[XmlRoot("schemafile")]
public class Schemafile
{
    private Module module;
    [XmlElement("schemalist", typeof(Module))]
    public Module ModuleName
    {
        get { return module; }
        set { module = value; }
    }
}


public class Module
{
    [XmlElement("schema", typeof(Setting))]
    public ArrayList SchemaList = new ArrayList();

    [XmlAttribute("module", typeof(string))]
    public string Name
    {
        get { return name; }
        set { name = value;}
    }
}

 public class Setting
{
    ...
}


The object Schemafile is created with the right ModuleName. Module is
created with the right Name, but SchemaList is empty. Setting is created
correctly.

Every time I have something like this, ArrayList is always empty:
XmlElement("element", typeof(Element))]
public ArrayList SomeList = new ArrayList();

I don't know what I am missing. I couldn't find similar examples on the web.

Thank you
Julien


More information about the Mono-list mailing list