By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,034 Members | 1,040 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,034 IT Pros & Developers. It's quick & easy.

class structure for repeating sequence of repeating elements?

P: n/a
I am trying to code a class for use with the XMLSerializer that can produce
XML valid for the following schema (fragment):

<xs:element name="Group">
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="SubElement1" />
<xs:element minOccurs="0" maxOccurs="1" name="SubElement2" />
<xs:element minOccurs="0" maxOccurs="1" name="SubElement3" />

Can anyone help with this (VB or C#)? If I try the following simple example,
I get an additional element (a) which is not what I need! (I know I declare
the array as an element, and this may be the problem, but I need to do
something there that specifies the type of the collected class, or I get an
exception when serializing)

class SubElements
public SubElement1 as string = "SubElement1Text"
public SubElement2 as string = "SubElement1Text"
public SubElement3 as string = "SubElement1Text"
end class

class Group
<XMLElement(Type:=GetType(SubElements)> _
public a as new ArrayList

sub new()
a.Add(new SubElements)
a.Add(new SubElements)
end sub
end class

Many thanks,

Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.