471,330 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

XmlArray with two unrelated XmlArrayItems

Hi,

does anyone know if I can have an XmlArray with two unrelated
XmlArrayItem,
i.e. where the items are not child-parent related?

I tried this, but I get an exception when creating the XmlSerializer.
[XmlArray("customers"), XmlArrayItem("names"),
XmlArrayItem("ids")]
(The classes of type "names" and "ids" are not related.)

Thanks for any insight!

Jun 27 '08 #1
2 5005
On 30 Mai, 14:06, bar...@bluezone.no wrote:
Hi,

does anyone know if I can have an XmlArray with two unrelated
XmlArrayItem,
i.e. where the items are not child-parent related?

I tried this, but I get an exception when creating the XmlSerializer.
* * * * [XmlArray("customers"), XmlArrayItem("names"),
XmlArrayItem("ids")]
(The classes of type "names" and "ids" are not related.)

Thanks for any insight!
Oooops, the code line above is not correct. But my question is still
valid: "can I have an XmlArray with two unrelated XmlArrayItems, i.e.
where the items are not child-parent related?".
Jun 27 '08 #2
You should just be able to declare multiple [XmlArrayItem] entries; what
error are you getting? Alternatively, you can actually do the same thing
with the [XmlElement] that accepts a Type:

[XmlElementAttribute("FOO", typeof(Foo))]
[XmlElementAttribute("BAR", typeof(Bar))]
public List<objectItems
{
get
{
return this.itemsField;
}
}

Marc
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by dungping5 | last post: by
3 posts views Thread by Kirsty Ryder | last post: by
1 post views Thread by Ryker | last post: by

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.